Set cluster submission script variables in cryosparc-tools

Hi,

Is there any way to set cluster submission script variables upon job queueing in cryosparc-tools?

Kotaro

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

Thank you @nfrasser ! This worked.

1 Like

FYI, the latest cryosparc-tools v4.5 (released May 7 2024 along with CryoSPARC v4.5) includes a dedicated cluster_vars argument for Job.queue.