Skip to content

Node

Note

This supersedes the pyslurm.node class, which will be removed in a future release

pyslurm.Node

A Slurm node.

Parameters:

Name Type Description Default
name str

Name of a node

None

Other Parameters:

Name Type Description
configured_gres dict

Configured GRES for the node

address str

Address of the node

hostname str

Hostname of the node

extra str

Arbitrary extra string

comment str

Comment for the node

weight int

Weight associated to the node

available_features list

Available features for the node

active_features list

Active features for the node

cpu_binding str

Default CPU-Binding for the node

state str

State of the node

reason str

Reason for the Node, typically used along with updating the node state

Attributes:

Name Type Description
name str

Name of the node.

architecture str

Architecture of the node (e.g. x86_64)

configured_gres dict

Generic Resources this Node is configured with.

owner str

User that owns the Node.

address str

Address of the node.

hostname str

Hostname of the node.

extra str

Arbitrary string attached to the Node.

reason str

Reason why this node is in its current state.

reason_user str

Name of the User who set the reason.

comment str

Arbitrary node comment.

bcast_address str

Address of the node for sbcast.

slurm_version str

Version of slurm this node is running on.

operating_system str

Name of the operating system installed.

allocated_gres dict

Generic Resources currently in use on the node.

mcs_label str

MCS label for the node.

allocated_memory int

Memory in Mebibytes allocated on the node.

real_memory int

Real Memory in Mebibytes configured for this node.

free_memory int

Free Memory in Mebibytes on the node.

memory_reserved_for_system int

Memory in Mebibytes reserved for the System not usable by Jobs.

temporary_disk int

Amount of temporary disk space this node has, in Mebibytes.

weight int

Weight of the node in scheduling.

effective_cpus int

Number of effective CPUs the node has.

total_cpus int

Total amount of CPUs the node has.

sockets int

Number of sockets the node has.

cores_reserved_for_system int

Number of cores reserved for the System not usable by Jobs.

boards int

Number of boards the node has.

cores_per_socket int

Number of cores per socket configured for the node.

threads_per_core int

Number of threads per core configured for the node.

available_features list

List of features available on the node.

active_features list

List of features on the node.

partitions list

List of partitions this Node is part of.

boot_time int

Time the node has booted, as unix timestamp.

slurmd_start_time int

Time the slurmd has started on the Node, as unix timestamp.

last_busy_time int

Time this node was last busy, as unix timestamp.

reason_time int

Time the reason was set for the node, as unix timestamp.

allocated_cpus int

Number of allocated CPUs on the node.

idle_cpus int

Number of idle CPUs.

cpu_binding str

Default CPU-Binding on the node.

cap_watts int

Node cap watts.

current_watts int

Current amount of watts consumed on the node.

avg_watts int

Average amount of watts consumed on the node.

external_sensors dict

External Sensor info for the Node. The dict returned contains the following information:

  • joules_total (int)
  • current_watts (int)
  • temperature (int)
state str

State the node is currently in.

next_state str

Next state the node will be in.

cpu_load float

CPU Load on the Node.

slurmd_port int

Port the slurmd is listening on the node.

create(state='future') method descriptor

Create a node.

Implements the slurm_create_node RPC.

Parameters:

Name Type Description Default
state str

An optional state the created Node should have. Allowed values are future and cloud. future is the default.

'future'

Returns:

Type Description
pyslurm.Node

This function returns the current Node-instance object itself.

Raises:

Type Description
RPCError

If creating the Node was not successful.

Examples:

>>> import pyslurm
>>> node = pyslurm.Node("testnode").create()

delete() method descriptor

Delete a node.

Implements the slurm_delete_node RPC.

Raises:

Type Description
RPCError

If deleting the Node was not successful.

Examples:

>>> import pyslurm
>>> pyslurm.Node("localhost").delete()

load(name) staticmethod

Load information for a specific node.

Implements the slurm_load_node_single RPC.

Parameters:

Name Type Description Default
name str

The name of the Node to load.

required

Returns:

Type Description
pyslurm.Node

Returns a new Node instance.

Raises:

Type Description
RPCError

If requesting the Node information from the slurmctld was not successful.

Examples:

>>> import pyslurm
>>> node = pyslurm.Node.load("localhost")

modify(changes) method descriptor

Modify a node.

Implements the slurm_update_node RPC.

Parameters:

Name Type Description Default
changes pyslurm.Node

Another Node object that contains all the changes to apply. Check the Other Parameters of the Node class to see which properties can be modified.

required

Raises:

Type Description
RPCError

When updating the Node was not successful.

Examples:

>>> import pyslurm
>>>
>>> mynode = pyslurm.Node.load("localhost")
>>> # Prepare the changes
>>> changes = pyslurm.Node(state="DRAIN", reason="DRAIN Reason")
>>> # Modify it
>>> mynode.modify(changes)

to_dict() method descriptor

Node information formatted as a dictionary.

Returns:

Type Description
dict

Node information as dict

Examples:

>>> import pyslurm
>>> mynode = pyslurm.Node.load("mynode")
>>> mynode_dict = mynode.to_dict()

pyslurm.Nodes

Bases: MultiClusterMap

A Multi Cluster collection of pyslurm.Node objects.

Parameters:

Name Type Description Default
nodes Union[list[str], dict[str, Node], str]

Nodes to initialize this collection with.

None

Attributes:

Name Type Description
free_memory int

Amount of free memory in this node collection. (in Mebibytes)

real_memory int

Amount of real memory in this node collection. (in Mebibytes)

allocated_memory int

Amount of alloc Memory in this node collection. (in Mebibytes)

total_cpus int

Total amount of CPUs in this node collection.

idle_cpus int

Total amount of idle CPUs in this node collection.

allocated_cpus int

Total amount of allocated CPUs in this node collection.

effective_cpus int

Total amount of effective CPUs in this node collection.

current_watts int

Total amount of Watts consumed in this node collection.

avg_watts int

Amount of average watts consumed in this node collection.

load(preload_passwd_info=False) staticmethod

Load all nodes in the system.

Parameters:

Name Type Description Default
preload_passwd_info bool

Decides whether to query passwd and groups information from the system. Could potentially speed up access to attributes of the Node where a UID/GID is translated to a name. If True, the information will fetched and stored in each of the Node instances. The default is False.

False

Returns:

Type Description
pyslurm.Nodes

Collection of node objects.

Raises:

Type Description
RPCError

When getting all the Nodes from the slurmctld failed.

modify(changes) method descriptor

Modify all Nodes in a collection.

Parameters:

Name Type Description Default
changes pyslurm.Node

Another Node object that contains all the changes to apply. Check the Other Parameters of the Node class to see which properties can be modified.

required

Raises:

Type Description
RPCError

When updating the Node was not successful.

Examples:

>>> import pyslurm
>>>
>>> nodes = pyslurm.Nodes.load()
>>> # Prepare the changes
>>> changes = pyslurm.Node(state="DRAIN", reason="DRAIN Reason")
>>> # Apply the changes to all the nodes
>>> nodes.modify(changes)

reload() method descriptor

Reload the information for Nodes in a collection.

Note

Only information for nodes which are already in the collection at the time of calling this method will be reloaded.

Returns:

Type Description
pyslurm.Nodes

Returns self

Raises:

Type Description
RPCError

When getting the Nodes from the slurmctld failed.