idmtools_platform_slurm.slurm_platform module#

Here we implement the SlurmPlatform object.

Copyright 2025, Gates Foundation. All rights reserved.

class idmtools_platform_slurm.slurm_platform.SlurmPlatform(_uid: str = None, _IItem__pre_creation_hooks: List[Callable[[ForwardRef('IItem'), ForwardRef('IPlatform')], NoneType]] = <factory>, _IItem__post_creation_hooks: List[Callable[[ForwardRef('IItem'), ForwardRef('IPlatform')], NoneType]] = <factory>, _platform_defaults: List[idmtools.entities.iplatform_default.IPlatformDefault] = <factory>, _config_block: str = None, job_directory: str = None, max_job: int = 4, run_sequence: bool = True, sym_link: bool = True, retries: int = 1, ntasks: Optional[int] = None, modules: list = <factory>, extra_packages: list = <factory>, mail_type: Optional[str] = None, mail_user: Optional[str] = None, nodes: Optional[int] = None, cpus_per_task: Optional[int] = None, ntasks_per_core: Optional[int] = None, max_running_jobs: Optional[int] = 100, mem: Optional[int] = None, mem_per_cpu: Optional[int] = None, partition: Optional[str] = None, constraint: Optional[str] = None, time: str = None, account: str = None, exclusive: bool = False, requeue: bool = True, sbatch_custom: Optional[str] = None, dir_exist_ok: bool = False, array_batch_size: int = None, run_on_slurm: bool = False, mpi_type: Optional[Literal['pmi2', 'pmix', 'mpirun']] = 'pmi2')[source]#

Bases: FilePlatform

mail_type: str | None = None#
mail_user: str | None = None#
nodes: int | None = None#
ntasks: int | None = None#
cpus_per_task: int | None = None#
ntasks_per_core: int | None = None#
max_running_jobs: int | None = 100#
mem: int | None = None#
mem_per_cpu: int | None = None#
partition: str | None = None#
constraint: str | None = None#
time: str = None#
account: str = None#
exclusive: bool = False#
requeue: bool = True#
retries: int = 1#
sbatch_custom: str | None = None#
modules: list#
dir_exist_ok: bool = False#
array_batch_size: int = None#
run_on_slurm: bool = False#
mpi_type: Literal['pmi2', 'pmix', 'mpirun'] | None = 'pmi2'#
property slurm_fields#

Get list of fields that have metadata sbatch. :returns: Set of fields that have sbatch metadata

get_slurm_configs(**kwargs) Dict[str, Any][source]#

Identify the Slurm config parameters from the fields. :param kwargs: additional parameters

Returns:

slurm config dict

create_batch_file(item: Experiment | Simulation, **kwargs) None[source]#

Create batch file. :param item: the item to build batch file for :param kwargs: keyword arguments used to expand functionality.

Returns:

None

get_job_id(item_id: str, item_type: ItemType) List[source]#

Retrieve the job id for item that had been run. :param item_id: id of experiment/simulation :param item_type: ItemType (Experiment or Simulation)

Returns:

List of slurm job ids

submit_job(item: Experiment | Simulation, **kwargs) None[source]#

Submit a Slurm job. :param item: idmtools Experiment or Simulation :param kwargs: keyword arguments used to expand functionality

Returns:

None

__init__(_uid: str = None, _IItem__pre_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _IItem__post_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _platform_defaults: ~typing.List[~idmtools.entities.iplatform_default.IPlatformDefault] = <factory>, _config_block: str = None, job_directory: str = None, max_job: int = 4, run_sequence: bool = True, sym_link: bool = True, retries: int = 1, ntasks: int | None = None, modules: list = <factory>, extra_packages: list = <factory>, mail_type: str | None = None, mail_user: str | None = None, nodes: int | None = None, cpus_per_task: int | None = None, ntasks_per_core: int | None = None, max_running_jobs: int | None = 100, mem: int | None = None, mem_per_cpu: int | None = None, partition: str | None = None, constraint: str | None = None, time: str = None, account: str = None, exclusive: bool = False, requeue: bool = True, sbatch_custom: str | None = None, dir_exist_ok: bool = False, array_batch_size: int = None, run_on_slurm: bool = False, mpi_type: ~typing.Literal['pmi2', 'pmix', 'mpirun'] | None = 'pmi2') None#