Set cluster submission script variables in cryosparc-tools

Hi @kttn, it’s not documented in the cryosparc-tools documentation, but there is a low-level CLI API you can call:

For CryoSPARC v4.5+:

from cryosparc.tools import CryoSPARC

cs = CryoSPARC(...)
job = cs.find_job("P#", "J#")

job.queue(lane="...", cluster_vars={
    # set variables here:
    "var_name": "var_value", 
    ...
})

For CryoSPARC v4.4 or older

from cryosparc.tools import CryoSPARC

cs = CryoSPARC(...)
job = cs.find_job("P#", "J#")

cs.cli.set_cluster_job_custom_vars(job.project_uid, job.uid, {
    # set variables here:
    "var_name": "var_value", 
    ...
})

job.queue(...)

Edit: Update instructions for cryosparc-tools v4.5

1 Like