find_processes
Description
Allows user to query the jobs database and retrieve information about the jobs which satisfy user-specified search criteria.
Simple Example
q = {'api_key':api_key,'query':{'status':'running'}}
dat = pq.find_processes(q,remote=True)
if not dat:
raise ValueError('received null response from server, expected non-null')
if not 'experiment_id' in dat:
raise ValueError('should be an experiment_id field in response from server')
if not 'compute_node' in dat:
raise ValueError('should be a compute_node field in response from server')
Simple Example Output
Failure Examples
# now we'll retrieve jobs with an invalid status and that should give us an empty data structure
q = {'api_key':api_key,'query':{'status':'rnning'}}
dat = pq.find_processes(q,remote=True)
if dat:
raise ValueError('response from server is non-null, should be null')
# we'll generate an invalid experiment id and search for jobs with that experiment id
# this should return an empty data structure
import uuid
eid = uuid.uuid1() # since this is a unique id, no experiment should have it as an id
q = {'api_key':api_key,'query':{'experiment_id':eid}}
dat = pq.find_processes(q,remote=True)
if dat:
raise ValueError('response from server is non-null, should be null')
Failure Examples Output
Three Examples
q = {'api_key':api_key,'query':{'name': {'$regex': '^financialApi' }}}
dat = pq.find_processes(q,remote=True)
if not dat:
raise ValueError('received null response from server, expected non-null')
if not 'experiment_id' in dat:
raise ValueError('should be an experiment_id field in response from server')
if not 'compute_node' in dat:
raise ValueError('should be a compute_node field in response from server')
q = {'api_key':api_key,'query':{'status':'running','settings.experiment_type':'financial_algorithm'}}
dat = pq.find_processes(q,remote=True)
# we have to determine what valid/invalid responses are here
# both empty and non-empty responses might be correct
dt = datetime.datetime.utcnow()-datetime.timedelta(days=30)
q = {'api_key':api_key,'query':{'status':'running','started':{'$gt':dt}}}
dat = pq.find_processes(q,remote=True)
# we have to determine what valid/invalid responses are here
# both empty and non-empty responses might be correct