srunx.containers package#

Submodules#

srunx.containers.apptainer module#

Apptainer / Singularity container runtime backend.

Generates apptainer exec (or singularity exec) as a launch_prefix that wraps the user command.

class srunx.containers.apptainer.ApptainerRuntime(binary='apptainer')[source]#

Bases: object

Apptainer/Singularity runtime backend – generates launch_prefix.

__init__(binary='apptainer')[source]#
build_launch_spec(config)[source]#
Return type:

LaunchSpec

srunx.containers.base module#

Base abstractions for container runtime backends.

class srunx.containers.base.LaunchSpec(prelude='', srun_args='', launch_prefix='')[source]#

Bases: object

Runtime-agnostic container launch specification.

Three distinct outputs model different injection points in generated scripts: - prelude: Shell setup lines executed before the command (e.g., declare arrays) - srun_args: Flags passed to srun itself (Pyxis uses this) - launch_prefix: Command wrapper prepended to the user command (Apptainer uses this)

prelude: str = ''#
srun_args: str = ''#
launch_prefix: str = ''#
__init__(prelude='', srun_args='', launch_prefix='')#
class srunx.containers.base.ContainerRuntime(*args, **kwargs)[source]#

Bases: Protocol

Protocol for container runtime backends.

build_launch_spec(config)[source]#
Return type:

LaunchSpec

__init__(*args, **kwargs)#

srunx.containers.pyxis module#

Pyxis container runtime backend.

Generates NVIDIA Pyxis –container-* flags as srun arguments, reproducing the existing behavior that was previously hardcoded in _build_environment_setup().

class srunx.containers.pyxis.PyxisRuntime[source]#

Bases: object

Pyxis runtime backend – generates –container-* srun flags.

build_launch_spec(config)[source]#
Return type:

LaunchSpec

Module contents#

Container runtime abstraction for srunx.

class srunx.containers.ContainerRuntime(*args, **kwargs)[source]#

Bases: Protocol

Protocol for container runtime backends.

__init__(*args, **kwargs)#
build_launch_spec(config)[source]#
Return type:

LaunchSpec

class srunx.containers.LaunchSpec(prelude='', srun_args='', launch_prefix='')[source]#

Bases: object

Runtime-agnostic container launch specification.

Three distinct outputs model different injection points in generated scripts: - prelude: Shell setup lines executed before the command (e.g., declare arrays) - srun_args: Flags passed to srun itself (Pyxis uses this) - launch_prefix: Command wrapper prepended to the user command (Apptainer uses this)

__init__(prelude='', srun_args='', launch_prefix='')#
launch_prefix: str = ''#
prelude: str = ''#
srun_args: str = ''#
class srunx.containers.PyxisRuntime[source]#

Bases: object

Pyxis runtime backend – generates –container-* srun flags.

build_launch_spec(config)[source]#
Return type:

LaunchSpec

class srunx.containers.ApptainerRuntime(binary='apptainer')[source]#

Bases: object

Apptainer/Singularity runtime backend – generates launch_prefix.

__init__(binary='apptainer')[source]#
build_launch_spec(config)[source]#
Return type:

LaunchSpec

srunx.containers.get_runtime(name)[source]#

Return a container runtime backend by name.

Parameters:

name (str) – Runtime identifier – “pyxis”, “apptainer”, or “singularity”.

Return type:

ContainerRuntime

Returns:

A ContainerRuntime implementation.

Raises:

ValueError – If the runtime name is not recognized.