anna-client的Python项目详细描述
安娜客户
设置
$ pip install anna-client
使用量
初始化
fromanna_client.clientimportClientclient=Client(endpoint='http://localhost:5000/graphql')
找工作
# get all job idsjobs=client.get_jobs()# you can specify a where clause & the fields you wish to receivejobs=client.get_jobs(where={'id_in',[...]},fields=('driver','site','status'))
创造就业机会
# create_jobs takes a list of dicts describing your jobsjobs=client.create_jobs(data=[{'driver':'firefox','site':'test'}])
删除作业
# provide no parameters in order to delete all jobsclient.delete_jobs(where={})# or delete specific jobsclient.delete_jobs(where={'id_in':my_jobs})
更新作业
# provide no where parameter in order to update all jobsclient.update_jobs(data={'status':'STOPPED'})# or update specific jobsclient.delete_jobs(where={'id_in':my_jobs},data={'status':'STOPPED'})
保留作业
# reserve_jobs takes a worker and a tuple of job idsclient.reserve_jobs(worker='worker',job_ids=my_jobs)
获取任务
# get_tasks takes a namespace & returns a url and a list of tuples containing the task names & definitionsurl,tasks=client.get_tasks(namespace='test')
欢迎加入QQ群-->: 979659372
推荐PyPI第三方库