Pydantic models¶
Pydantic model for capturing SLURM node information.
Classes:
| Name | Description |
|---|---|
AllocTRES |
Allocated Trackable Resources |
CfgTRES |
Configured Trackable Resources |
GPU |
GPU name and count. |
Node |
Slurm node model. |
State |
Node state |
Functions:
| Name | Description |
|---|---|
gpu_mem_from_features |
Get the GPU memory from features. |
Node
¶
Bases: BaseModel
Slurm node model.
Methods:
| Name | Description |
|---|---|
gres_validator |
Parameters |
gres_validator
¶
Parameters¶
_value : str The string to parse - cpu:192 - gpu:RTX6000:3 - gpu:a100:4(S:0-1),cpu:72 - gpu:a100_3g.20gb:8(S:0-1),cpu:72 - gpu:a100:4(S:0-1),nvme:3500 - a100_4g:2,a100_3g:2
Source code in src/slurm_viewer/data/node_model.py
gpu_mem_from_features
¶
gpu_mem_from_features(
_features: list[str],
) -> MemoryUsed | None
Get the GPU memory from features.
Source code in src/slurm_viewer/data/node_model.py
Functions:
| Name | Description |
|---|---|
condense_string_list |
Condenses a list of similar strings by grouping consecutive numbers. |
format_group |
Formats a group of numbers into a comma-separated string with ranges. |
condense_string_list
¶
Condenses a list of similar strings by grouping consecutive numbers.
Args: string_list: A list of strings with a common prefix and a numerical suffix.
Returns: A list of strings where consecutive numerical suffixes are grouped using a hyphen.
Source code in src/slurm_viewer/data/partitions_model.py
format_group
¶
Formats a group of numbers into a comma-separated string with ranges.
Args: prefix: The common prefix of the strings. numbers: A sorted list of integers.
Returns: A formatted string representing the group.
Source code in src/slurm_viewer/data/partitions_model.py
Pydantic model for capturing SLURM queue information.
Classes:
| Name | Description |
|---|---|
JobStateCodes |
Job state codes. |
Queue |
Slurm queue model. |
Queue
¶
Bases: BaseModel
Slurm queue model.
Methods:
| Name | Description |
|---|---|
gres_validator |
Parameters |
gres_validator
¶
Parameters¶
_value : str The string to parse - cpu:192 - gpu:RTX6000:3 - gpu:a100:4(S:0-1),cpu:72 - gpu:a100_3g.20gb:8(S:0-1),cpu:72 - gpu:a100:4(S:0-1),nvme:3500 - a100_4g:2,a100_3g:2