# New options in slurm scheduler headers

**URL:** <https://aiida.discourse.group/t/new-options-in-slurm-scheduler-headers/390>\
**Category:** Developer\
**Tags:** question\
**Created:** [May 17, 2024, 3:25pm UTC](https://aiida.discourse.group/t/new-options-in-slurm-scheduler-headers/390 "2024-05-17T15:25:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fpa88](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/fpa88/32/149_2.png) [@fpa88](https://aiida.discourse.group/u/fpa88)\
**Post date:** [May 17, 2024, 3:25pm UTC](https://aiida.discourse.group/t/new-options-in-slurm-scheduler-headers/390/1 "2024-05-17T15:25:41Z")

</div>

Hi,  
Would it be possible to add new options for building the slurm header?  
I’ve identified 3 files that need to be modified to add the “exclude” and “constraint” slurm options.

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [May 17, 2024, 8:25pm UTC](https://aiida.discourse.group/t/new-options-in-slurm-scheduler-headers/390/2 "2024-05-17T20:25:34Z")

</div>

Hi @fpa88 , not sure if you were already aware of this option, but the easiest is to define the SLURM headers directly in the [`custom_scheduler_commands` metadata option](https://aiida.readthedocs.io/projects/aiida-core/en/stable/topics/calculations/usage.html#options). You can define it per job instance, e.g.

```python
results, node = run.get_node(
    SomeCalcJob,
    ...,
    metadata={
        'options': {
            'custom_scheduler_commands': '#SLURM --constraint=...'
       }
    }
)

```

If the values are “static” and are not going to change often between different jobs, you can also opt to configure them in the `prepend_text` of the `Code`. Whenever you use that `Code` as an input for a job, the `prepend_text` is automatically inserted into the submission script.

---

<div class="post-metadata">

**Author:** ![fpa88](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/fpa88/32/149_2.png) [@fpa88](https://aiida.discourse.group/u/fpa88)\
**Post date:** [May 21, 2024, 8:52am UTC](https://aiida.discourse.group/t/new-options-in-slurm-scheduler-headers/390/3 "2024-05-21T08:52:58Z")

</div>

Hi,  
Perfect, I will do like this.  
Thanks

---

<div class="post-metadata">

**Author:** ![fpa88](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/fpa88/32/149_2.png) [@fpa88](https://aiida.discourse.group/u/fpa88)\
**Post date:** [May 21, 2024, 11:29am UTC](https://aiida.discourse.group/t/new-options-in-slurm-scheduler-headers/390/4 "2024-05-21T11:29:42Z")

</div>

It’s working. I need to define a string in this way :  
OPTIONS = AttributeDict()  
OPTIONS.custom\_scheduler\_commands = ‘#SBATCH --constraint=Feature1\n#SBATCH --exclude=mycomputenode01’
