hi, i would like to be able to view a list of the running and queued jobs in the work queue, via cli. is this possible?
Hi @yee379,
At the moment there isn’t a command to print out this list in table form (similar to cryosparcm listusers
), although you can still retrieve this information from the command line easily:
- Enter the interactive Python shell:
cryosparcm icli
- The cryoSPARC CLI has a
get_jobs_by_status
function that takes two arguments: a status (or MongoDB query object, as we will use) and whether or not to just return a count of jobs or the actual MongoDB documents:
Return the count of all queued and active jobs:
cli.get_jobs_by_status({ '$in': ['queued', 'launched', 'started', 'waiting', 'running']}, True)
Return a tuple of project ID, job ID, status and job type for all queued and active jobs:
[(j['project_uid'], j['uid'], j['status'], j['job_type']) for j in cli.get_jobs_by_status({ '$in': ['queued', 'launched', 'started', 'waiting', 'running']})]
Return the full MongoDB documents for all queued and active jobs:
cli.get_jobs_by_status({ '$in': ['queued', 'launched', 'started', 'waiting', 'running']})
Hope this helps!
- Suhail