<commit_before>shale
=====

A Flask-backed REST API to manage Selenium sessions.

.. pypi - Everything below this line goes into the description for PyPI.


Progress
--------

Right now, the service is basically a replacement for a Selenium hub. We've
found hubs to be more trouble than they're worth operationally, but we still
need some of the management features.

Currently shale let's you get, create, and delete webdriver sessions, as well as
managing which sessions are currently reserved or tagged. Keep-alive pings have
have been implemented, and it's easy to integrate with a cloud provider (eg,
AWS) to auto-scale nodes by implementing a custom `NodePool`.

Running
-------

Clone the repo and install the requirements

.. code:: sh

    git clone <EMAIL>:cardforcoin/shale.git
    pip install -r requirements.txt

In development, you can run the Flask dev server.

.. code:: sh

    python wsgi.py

In production, use gunicorn.

.. code:: sh

    gunicorn -b 127.0.0.1:5000 wsgi:app -t 120 --log-file -

Configuration
-------------

To provide a configuration module, include a  variable `SHALE_SETTINGS` in your
environment. Current options include the basic config provided by Flask, as well
as a configurable `HUB_POOL` for dynamic hub selection.

Examples
--------

curl
~~~~

.. code::

    $ curl -d '{"browser_name":"phantomjs"}' -XPOST \
           http://localhost:5000/sessions/ \
           --header "Content-Type:application/json"
    {
      "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
      "reserved": false,
      "node": "http://localhost:5555/wd/hub",
      "browser_name": "phantomjs",
      "tags": []
    }

List all the active sessions
<commit_msg>something about running lein<commit_after>shale
=====

A Flask-backed REST API to manage Selenium sessions.

.. pypi - Everything below this line goes into the description for PyPI.


Progress
--------

Right now, the service is basically a replacement for a Selenium hub. We've
found hubs to be more trouble than they're worth operationally, but we still
need some of the management features.

Currently shale let's you get, create, and delete webdriver sessions, as well as
managing which sessions are currently reserved or tagged. Keep-alive pings have
have been implemented, and it's easy to integrate with a cloud provider (eg,
AWS) to auto-scale nodes by implementing a custom `NodePool`.

Running
-------

Clone the repo

.. code:: sh

    git clone <EMAIL>:cardforcoin/shale.git

Something

.. code:: sh

    lein run

Something else

.. code:: sh

    lein ring server

Configuration
-------------

To provide a configuration module, include a  variable `SHALE_SETTINGS` in your
environment. Current options include the basic config provided by Flask, as well
as a configurable `HUB_POOL` for dynamic hub selection.

Examples
--------

curl
~~~~

.. code::

    $ curl -d '{"browser_name":"phantomjs"}' -XPOST \
           http://localhost:5000/sessions/ \
           --header "Content-Type:application/json"
    {
      "id": "05e9229d-356b-46a3-beae-f8ab02cea7db",
      "reserved": false,
      "node": "http://localhost:5555/wd/hub",
      "browser_name": "phantomjs",
      "tags": []
    }

List all the active sessions

{'fraction_non_alphanumeric': 0.11121466293880088, 'fraction_numerical': 0.018949984467225848, 'mean_word_length': 3.060529634300126, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6105936', 'n_tokens_mistral': 1010, 'n_tokens_neox': 928, 'n_words': 377}