Skip to content

[Bug] How to use SlurmClusterExecutor #952

@pmrv

Description

@pmrv

I'm trying to follow the docs over here

submission_template = """\
#!/bin/bash
#SBATCH --output=time.out
#SBATCH --job-name={{job_name}}
#SBATCH --chdir={{working_directory}}
#SBATCH --get-user-env=L
#SBATCH --partition={{partition}}
{%- if run_time_max %}
#SBATCH --time={{ [1, run_time_max // 60]|max }}
{%- endif %}
{%- if dependency %}
#SBATCH --dependency=afterok:{{ dependency | join(',') }}
{%- endif %}
{%- if memory_max %}
#SBATCH --mem={{memory_max}}G
{%- endif %}
#SBATCH --cpus-per-task={{cores}}

{{command}}
"""

with SlurmClusterExecutor(cache_directory="./cache") as exe:
    future = exe.submit(
        sum, [4, 4], 
        resource_dict={
            "submission_template": submission_template, 
            "run_time_max": 180,  # in seconds  
            "partition": "s.cmfe",
        })
    print(future.result())

but it prints this warning

[/lib/python3.12/site-packages/executorlib/task_scheduler/base.py:132](https://localhost:8000/u/zora/.conda/envs/2026_02_GRACE_MELTING_POINTS_FEP/lib/python3.12/site-packages/executorlib/task_scheduler/base.py#line=131): UserWarning: The following keys are not recognized and cannot be validated: ['submission_template', 'run_time_max', 'partition']
  self._validator(resource_dict=resource_dict)

The code itself runs in that the correct result is returned, but it doesn't actually submit a slurm job and seems to just run on the node the code is run on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions