# slurm_script_generator.clusters

*module*

Per-cluster presets for ``slurm-template``'s ``--cluster`` flag.

Each preset fills in the handful of pragmas that are specific to one HPC
system's SLURM configuration — mainly ``--partition`` and ``--qos``, chosen
separately for CPU-only and GPU jobs — without touching anything the caller
already set explicitly. It also points at that system's own documentation,
since partition/QOS naming and limits are the kind of thing that changes
over time and should be double-checked there, not trusted blindly from here.

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L1-L1)

## slurm_script_generator.clusters.CLUSTERS

*attribute* · *module attribute*

```python
CLUSTERS: Dict[str, ClusterPreset] = {'pitagora': ClusterPreset(doc_url='https://docs.hpc.cineca.it/hpc/pitagora.html#job-managing-and-slurm-partitions', cpu_partition='dcgp_fua_prod', cpu_qos='normal', gpu_partition='boost_fua_prod', gpu_qos='normal', notes=['Production partitions on Pitagora need a budgeted --account; only ptgr_all_serial is budget-free.'])}
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L30-L42)

## slurm_script_generator.clusters.ClusterPreset

*class* · *dataclass*

```python
class ClusterPreset
```

Typical partition/QOS defaults for one HPC system.

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L15-L24)

### slurm_script_generator.clusters.ClusterPreset.cpu_partition

*attribute* · *class attribute* · *instance attribute*

```python
cpu_partition: Optional[str] = None
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L20-L20)

### slurm_script_generator.clusters.ClusterPreset.cpu_qos

*attribute* · *class attribute* · *instance attribute*

```python
cpu_qos: Optional[str] = None
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L21-L21)

### slurm_script_generator.clusters.ClusterPreset.doc_url

*attribute* · *instance attribute*

```python
doc_url: str
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L19-L19)

### slurm_script_generator.clusters.ClusterPreset.gpu_partition

*attribute* · *class attribute* · *instance attribute*

```python
gpu_partition: Optional[str] = None
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L22-L22)

### slurm_script_generator.clusters.ClusterPreset.gpu_qos

*attribute* · *class attribute* · *instance attribute*

```python
gpu_qos: Optional[str] = None
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L23-L23)

### slurm_script_generator.clusters.ClusterPreset.notes

*attribute* · *class attribute* · *instance attribute*

```python
notes: List[str] = field(default_factory=list)
```

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L24-L24)

## slurm_script_generator.clusters.apply_cluster

*function*

```python
def apply_cluster(name: str, overrides: Dict[str, object], uses_gpu: bool) -> None
```

Fill cluster-specific partition/QOS defaults into *overrides*, in place.

Only sets a key that's still None, so a value the caller already passed
explicitly (e.g. an explicit ``--partition``) always wins over the preset.

Parameters
----------
name : str
    A key in :data:`CLUSTERS`.
overrides : dict
    The in-progress overrides dict to update in place.
uses_gpu : bool
    Whether the job requests a GPU, to pick the GPU vs CPU partition/QOS.

Raises
------
KeyError
    If *name* is not a known cluster.

[View source](https://github.com/max-models/slurm-script-generator/blob/devel/src/slurm_script_generator/clusters.py#L45-L75)
