With help from our team…
In CryoSPARC before version 4, you might write a script like
#! /usr/bin/env python
import os
from pymongo import MongoClient
db = MongoClient(f"mongodb://{os.getenv('CRYOSPARC_MASTER_HOSTNAME')}:{os.getenv('CRYOSPARC_MONGO_PORT')}")['meteor']
result = [(j['project_uid'], j['uid'], j['status'], j['job_type']) for j in
db.jobs.find(
{ "status": { '$in': ['queued', 'launched', 'started', 'waiting', 'running']}})]
print(result)
In CryoSPARC version 4, you might write a script like
#! /usr/bin/env python
from cryosparc_compute import database_management
db = database_management.get_pymongo_client('meteor')['meteor']
result = [(j['project_uid'], j['uid'], j['status'], j['job_type']) for j in
db.jobs.find(
{ "status": { '$in': ['queued', 'launched', 'started', 'waiting', 'running']}})]
print(result)
The script can be saved to a file like pending_jobs.py
, the file made executable and invoked with
cryosparcm call /full/path/to/pending_jobs.py