libmuscle.native_instantiator.global_resources module

class libmuscle.native_instantiator.global_resources.GlobalResources[source]

Bases: object

Detects available compute resources.

This detects whether we’re running locally or in a SLURM allocation, and returns available resources on request. This class describes all the available resources, not the ones local to a node.

scheduler

The HPC scheduler we’re running under, if any.

nodes

List of hostnames of available nodes to run on.

logical_cpus_per_node

Number of cores available on each node. List alongside nodes.

agent_launch_command(agent_cmd: list[str]) list[str][source]

Return a command for launching one agent on each node.

Parameters:

agent_cmd – A command that will start the agent.

on_cluster() bool[source]

Return whether we’re running on a cluster.

class libmuscle.native_instantiator.global_resources.Scheduler(*values)[source]

Bases: Enum

NONE = 0
SLURM = 1
libmuscle.native_instantiator.global_resources.global_resources() GlobalResources[source]

Wrapper for _global_resources.

This is here to ensure that the object gets created after we’ve configured logging, so that the log output it generates actually ends up in the manager log.

The users are all in the main thread of the NativeInstantiator background process, so there’s no need for a lock right now.