Using job_type in slurm if statement

We’d like to set our Cryosparc instance to send all 3dflex jobs to a specific SLURM partition, and everything else to a different one. What should we put for the if statement?

The following fails:

{%- if job_type == 3dflex %}
#SBATCH --partition=3dflex
{%- else %}
#SBATCH --partition=All
{%- endif %}

The error:

ServerError: expected token 'end of statement block', got 'dflex'
Traceback (most recent call last):
  File "/cryosparc-master/cryosparc_master/cryosparc_command/", line 196, in wrapper
    res = func(*args, **kwargs)
  File "/cryosparc-master/cryosparc_master/cryosparc_command/command_core/", line 1762, in add_scheduler_target_cluster
    tpl_vars = parse_template_vars(new_target)
  File "/cryosparc-master/cryosparc_master/cryosparc_command/command_core/", line 1785, in parse_template_vars
    tpl_ast = env.parse(target[template])
  File "/cryosparc-master/cryosparc_master/deps/anaconda/envs/cryosparc_master_env/lib/python3.8/site-packages/jinja2/", line 535, in parse
  File "/cryosparc-master/cryosparc_master/deps/anaconda/envs/cryosparc_master_env/lib/python3.8/site-packages/jinja2/", line 832, in handle_exception
  File "/cryosparc-master/cryosparc_master/deps/anaconda/envs/cryosparc_master_env/lib/python3.8/site-packages/jinja2/", line 28, in reraise
    raise value.with_traceback(tb)
  File "<unknown>", line 13, in template
jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got 'dflex'

What’s the correct job_type for 3dflex jobs?

1 Like

from cryosparc_master/cryosparc_compute/jobs/

    185     {'name' : 'flexibility',
    186      'title' : 'Flexible Refinement',
    187      'description' : 'useful description.',
    188      'contains' : [
    189                     'flex_prep',
    190                     'flex_meshprep',
    191                     'flex_train',
    192                     'flex_highres',
    193                     'flex_generate',
    194                     'flex_disp',
    195                   ]
    196     },

For a comprehensive list, you may run

cryosparcm cli "get_job_sections()"

It might be helpful to add a list of the job_type IDs in the documentation as right now all it mentions is that job_type is an option to use as a variable.

For instance, as you need to install 3dflex, it makes more sense (to me) that the ID would be 3dflex instead of flexibility