anna API client
Project description
anna client
setup
$ pip install anna-client
usage
initialization
from anna_client.client import Client
client = Client(endpoint='http://localhost:5000/graphql')
get jobs
# get all job ids
jobs = client.get_jobs()
# you can specify a where clause & the fields you wish to receive
jobs = client.get_jobs(where={'id_in', [...]}, fields=('driver','site','status'))
create jobs
# create_jobs takes a list of dicts describing your jobs
jobs = client.create_jobs(data=[{'driver': 'firefox', 'site': 'test'}])
delete jobs
# provide no parameters in order to delete all jobs
client.delete_jobs(where={})
# or delete specific jobs
client.delete_jobs(where={'id_in': my_jobs})
update jobs
# provide no where parameter in order to update all jobs
client.update_jobs(data={'status': 'STOPPED'})
# or update specific jobs
client.delete_jobs(where={'id_in': my_jobs}, data={'status': 'STOPPED'})
reserve jobs
# reserve_jobs takes a worker and a tuple of job ids
client.reserve_jobs(worker='worker', job_ids=my_jobs)
get tasks
# get_tasks takes a namespace & returns a url and a list of tuples containing the task names & definitions
url, tasks = client.get_tasks(namespace='test')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anna-client-1.1.2.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for anna_client-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f2fffda18b87d6cf78444c3e543901d74c267cdc37dbcef164db4bc626ebc8 |
|
MD5 | 25f9f1bd1a802e0f023114689fa2749a |
|
BLAKE2b-256 | 5d17716c691529ff43dda591d1d5b35bf8500ff4933cea4e853d7426948fccad |