Partition
Note
This supersedes the pyslurm.partition class, which will be removed in a future release
pyslurm.Partition
A Slurm partition.
Setting Memory related attributes
Unless otherwise noted, all attributes in this class representing a
memory value, like default_memory_per_cpu
, may also be set with a
string that contains suffixes like "K", "M", "G" or "T".
For example:
default_memory_per_cpu = "10G"
This will internally be converted to 10240 (how the Slurm API expects it)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of a Partition |
None
|
**kwargs
|
Any
|
Every attribute of a Partition can be set, except for:
|
required |
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Name of the Partition. |
allowed_submit_nodes |
list[str]
|
List of Nodes from which Jobs can be submitted to the partition. |
allowed_accounts |
list[str]
|
List of Accounts which are allowed to execute Jobs |
allowed_groups |
list[str]
|
List of Groups which are allowed to execute Jobs |
allowed_qos |
list[str]
|
List of QoS which are allowed to execute Jobs |
alternate |
str
|
Name of the alternate Partition in case a Partition is down. |
select_type_parameters |
list[str]
|
List of Select type parameters for the select plugin. |
cpu_binding |
str
|
Default CPU-binding for Jobs that execute in a Partition. |
default_memory_per_cpu |
int
|
Default Memory per CPU for Jobs in this Partition, in Mebibytes.
Mutually exclusive with This can also return UNLIMITED |
default_memory_per_node |
int
|
Default Memory per Node for Jobs in this Partition, in Mebibytes.
Mutually exclusive with This can also return UNLIMITED |
max_memory_per_cpu |
int
|
Max Memory per CPU allowed for Jobs in this Partition, in
Mebibytes. Mutually exclusive with This can also return UNLIMITED |
max_memory_per_node |
int
|
Max Memory per Node allowed for Jobs in this Partition, in
Mebibytes. Mutually exclusive with This can also return UNLIMITED |
default_time |
int
|
Default run time-limit in minutes for Jobs that don't specify one. This can also return UNLIMITED |
denied_qos |
list[str]
|
List of QoS that cannot be used in a Partition |
denied_accounts |
list[str]
|
List of Accounts that cannot use a Partition |
preemption_grace_time |
int
|
Grace Time in seconds when a Job is selected for Preemption. |
default_cpus_per_gpu |
int
|
Default CPUs per GPU for Jobs in this Partition |
default_memory_per_gpu |
int
|
Default Memory per GPU, in Mebibytes, for Jobs in this Partition |
max_cpus_per_node |
int
|
Max CPUs per Node allowed for Jobs in this Partition This can also return UNLIMITED |
max_cpus_per_socket |
int
|
Max CPUs per Socket allowed for Jobs in this Partition This can also return UNLIMITED |
max_nodes |
int
|
Max number of Nodes allowed for Jobs This can also return UNLIMITED |
min_nodes |
int
|
Minimum number of Nodes that must be requested by Jobs |
max_time |
int
|
Max Time-Limit in minutes that Jobs can request This can also return UNLIMITED |
oversubscribe |
str
|
The oversubscribe mode for this Partition |
nodes |
str
|
Nodes that are in a Partition |
nodesets |
list[str]
|
List of Nodesets that a Partition has configured |
over_time_limit |
int
|
Limit in minutes that Jobs can exceed their time-limit This can also return UNLIMITED |
preempt_mode |
str
|
Preemption Mode in a Partition |
priority_job_factor |
int
|
The Priority Job Factor for a partition |
priority_tier |
int
|
The priority tier for a Partition |
qos |
str
|
A QoS associated with a Partition, used to extend possible limits |
total_cpus |
int
|
Total number of CPUs available in a Partition |
total_nodes |
int
|
Total number of nodes available in a Partition |
state |
str
|
State the Partition is in |
is_default |
bool
|
Whether this Partition is the default partition or not |
allow_root_jobs |
bool
|
Whether Jobs by the root user are allowed |
is_user_exclusive |
bool
|
Whether nodes will be exclusively allocated to users |
is_hidden |
bool
|
Whether the partition is hidden or not |
least_loaded_nodes_scheduling |
bool
|
Whether Least-Loaded-Nodes scheduling algorithm is used on a Partition |
is_root_only |
bool
|
Whether only root is able to use a Partition |
requires_reservation |
bool
|
Whether a reservation is required to use a Partition |
power_down_on_idle |
bool
|
Whether nodes power down on idle after running jobs |
create()
method descriptor
delete()
method descriptor
Delete a Partition.
Implements the slurm_delete_partition RPC.
Raises:
Type | Description |
---|---|
RPCError
|
When deleting the Partition was not successful. |
Examples:
load(name)
staticmethod
Load information for a specific Partition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the Partition to load. |
required |
Returns:
Type | Description |
---|---|
Partition
|
Returns a new Partition instance. |
Raises:
Type | Description |
---|---|
RPCError
|
If requesting the Partition information from the slurmctld was not successful. |
Examples:
modify(changes)
method descriptor
Modify a Partition.
Implements the slurm_update_partition RPC.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
changes
|
Partition
|
Another Partition object that contains all the changes to
apply. Check the |
required |
Raises:
Type | Description |
---|---|
RPCError
|
When updating the Partition was not successful. |
Examples:
to_dict()
method descriptor
Partition information formatted as a dictionary.
Returns:
Type | Description |
---|---|
dict
|
Partition information as dict |
Examples:
pyslurm.Partitions
Bases: pyslurm.xcollections.MultiClusterMap
A Multi Cluster
collection of pyslurm.Partition objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
partitions
|
Union[list[str], dict[str, Partition], str]
|
Partitions to initialize this collection with. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
total_cpus |
int
|
Total amount of CPUs the Partitions in a Collection have |
total_nodes |
int
|
Total amount of Nodes the Partitions in a Collection have |
load()
staticmethod
Load all Partitions in the system.
Returns:
Type | Description |
---|---|
Partitions
|
Collection of Partition objects. |
Raises:
Type | Description |
---|---|
RPCError
|
When getting all the Partitions from the slurmctld failed. |
modify(changes)
method descriptor
Modify all Partitions in a Collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
changes
|
Partition
|
Another Partition object that contains all the changes to
apply. Check the |
required |
Raises:
Type | Description |
---|---|
RPCError
|
When updating at least one Partition failed. |
Examples:
reload()
method descriptor
Reload the information for Partitions in a collection.
Note
Only information for Partitions which are already in the collection at the time of calling this method will be reloaded.
Returns:
Type | Description |
---|---|
Partitions
|
Returns self |
Raises:
Type | Description |
---|---|
RPCError
|
When getting the Partitions from the slurmctld failed. |