idmtools_platform_slurm.slurm_platform module

Here we implement the SlurmPlatform object.

Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.

class idmtools_platform_slurm.slurm_platform.SlurmPlatform(*args, **kwargs)

Bases: IPlatform

job_directory: str = None
bridged_jobs_directory: str = PosixPath('/home/docs/.idmtools/singularity-bridge')

Needed for bridge mode

bridged_results_directory: str = PosixPath('/home/docs/.idmtools/singularity-bridge/results')
mode: SlurmOperationalMode = None
mail_type: Optional[str] = None
mail_user: Optional[str] = None
nodes: Optional[int] = None
ntasks: Optional[int] = None
cpus_per_task: Optional[int] = None
ntasks_per_core: Optional[int] = None
max_running_jobs: Optional[int] = None
mem: Optional[int] = None
mem_per_cpu: Optional[int] = None
partition: Optional[str] = None
time: str = None
account: str = None
exclusive: bool = False
requeue: bool = True
retries: int = 1
sbatch_custom: Optional[str] = None
modules: list
post_setstate()

Function called after restoring the state if additional initialization is required.

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]

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

Returns:

slurm config dict

flatten_item(item: IEntity, raw=False, **kwargs) List[object]

Flatten an item: resolve the children until getting to the leaves.

For example, for an experiment, will return all the simulations. For a suite, will return all the simulations contained in the suites experiments.

Parameters:
  • item – Which item to flatten

  • raw – bool

  • kwargs – extra parameters

Returns:

List of leaves

validate_item_for_analysis(item: Union[Simulation, SlurmSimulation], analyze_failed_items=False)

Check if item is valid for analysis.

Parameters:
  • item – which item to verify status

  • analyze_failed_items – bool

Returns: bool

__init__(_uid: ~uuid.UUID = 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, bridged_jobs_directory: str = PosixPath('/home/docs/.idmtools/singularity-bridge'), bridged_results_directory: str = PosixPath('/home/docs/.idmtools/singularity-bridge/results'), mode: ~idmtools_platform_slurm.slurm_operations.slurm_constants.SlurmOperationalMode = None, mail_type: ~typing.Optional[str] = None, mail_user: ~typing.Optional[str] = None, nodes: ~typing.Optional[int] = None, ntasks: ~typing.Optional[int] = None, cpus_per_task: ~typing.Optional[int] = None, ntasks_per_core: ~typing.Optional[int] = None, max_running_jobs: ~typing.Optional[int] = None, mem: ~typing.Optional[int] = None, mem_per_cpu: ~typing.Optional[int] = None, partition: ~typing.Optional[str] = None, time: str = None, account: str = None, exclusive: bool = False, requeue: bool = True, retries: int = 1, sbatch_custom: ~typing.Optional[str] = None, modules: list = <factory>) None