How to get job stats from the command line

Dear cryoSPARC pros,

We have a common setup of 4 servers (cryosparc + cryosparc live) happily heavily used.
As administrator, I can see on job history details about all the jobs running so far.

My question is: is it possible to retrieve this job information form the command line?
Why I ask: we have a munin monitoring system to check the resource usage, running over each of our 4 cryosparc nodes.
It will be possible to write a munin plugin to show us how many jobs were submitted (and how many failed, and so on). But for that I need to gather the info through command line.

(this is on the line of @olibclarke post How to monitor jobs from the command line? )

Can someone tell me if this is possible?

Thanks!

Juan

Yes, Possible!

Here is a quick script to dump job numbers and types:

#!/usr/bin/env python
import os
import sys
sys.path.append(os.environ['CRYOSPARC_ROOT_DIR'])
from cryosparc2_compute.client import CommandClient

host  = os.environ['CRYOSPARC_MASTER_HOSTNAME']
cliport = os.environ['CRYOSPARC_COMMAND_CORE_PORT']
cli = CommandClient(host, int(cliport))

def dump_jobs():
    projects = cli.list_projects()
    for p in projects:
        for j in cli.list_jobs(p['uid']):
            print p['uid'],j['uid'],j['job_type']

if __name__ == "__main__":
    dump_jobs()

Run it as such:

 <path-to-cryosparccm>/cryosparcm call ./dump_jobs.py

and it should dump out the project, job, and job type. There is a lot of job information in the job β€˜j’ variable to look at, just select what you need.

3 Likes

Wow great, it works, and it’s a lot of information!
Now I need to find out the best way to display it :heart_eyes:
Anyone interested may ask me later about the munin plugins (not yet written).

Thanks @karcaw !!