Cryosparc cli job status

Hello all,

we have already a few separated instances of cryosparc running.
At this moment some of them seem to be inactive.
To be sure, I was wondering if it would be possible, in one line, to find out when was the last job running on a specific instance.

Something on the line of "

cryosparcm icli
cli.get_jobs_by_status({'$in' : ['launched']})'

If possible, so that we can run it as a bash script.
Basically, we want to know if the instance is working, and if yes, when was the last time it was used.

Thank you for your time!


On CryoSPARC version 4, you could save

#! /usr/bin/env python

from cryosparc_compute import database_management
db = database_management.get_pymongo_client('meteor')['meteor']

print(sorted(filter(lambda s: s.get('launched_at'),
        {}, {'_id':0, 'project_uid':1, 'uid':1, 
                      'launched_at':1, 'completed_at':1})),
             key=lambda r: r.get('launched_at'))[-1])

to a file called and run
cryosparcm call python /full/path/to/

Wow that’s exactly what I wanted, thanks a lot, @wtempel !
For the records, sample output:

{'project_uid': 'P11', 'uid': 'J29', 'completed_at': datetime.datetime(2023, 1, 12, 21, 7, 26, 325000), 'launched_at': datetime.datetime(2023, 1, 12, 18, 24, 15, 760000)}

Now I just need to record that and parse it.
For the records also, the script throws an error for old cryosparcs (before 4).
But that’s OK, probably we will not monitor those.
I will close this.


That is expected. Older versions of CryoSPARC connect to the database using different commands.

1 Like