idmtools_platform_slurm.slurm_operations.local_operations module#

Here we implement the SlurmPlatform local operations.

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

class idmtools_platform_slurm.slurm_operations.local_operations.LocalSlurmOperations(platform: 'SlurmPlatform', platform_type: Type = None)[source]#

Bases: SlurmOperations

entity_display_name(item: Suite | Experiment | Simulation) str[source]#

Get display name for entity. :param item: Suite, Experiment or Simulation

Returns:

str

get_directory(item: Suite | Experiment | Simulation) Path[source]#

Get item’s path. :param item: Suite, Experiment, Simulation

Returns:

item file directory

get_directory_by_id(item_id: str, item_type: ItemType) Path[source]#

Get item’s path. :param item_id: entity id (Suite, Experiment, Simulation) :param item_type: the type of items (Suite, Experiment, Simulation)

Returns:

item file directory

mk_directory(item: Suite | Experiment | Simulation | None = None, dest: Path | str | None = None, exist_ok: bool | None = None) None[source]#

Make a new directory. :param item: Suite/Experiment/Simulation :param dest: the folder path :param exist_ok: True/False

Returns:

None

Link files. :param target: the source file path :param link: the file path

Returns:

None

Link directory/files. :param target: the source folder path. :param link: the folder path

Returns:

None

static update_script_mode(script_path: Path | str, mode: int = 511) None[source]#

Change file mode. :param script_path: script path :param mode: permission mode

Returns:

None

make_command_executable(simulation: Simulation) None[source]#

Make simulation command executable :param simulation: idmtools Simulation

Returns:

None

create_batch_file(item: Experiment | Simulation, max_running_jobs: int | None = None, retries: int | None = None, array_batch_size: int | None = None, dependency: bool = True, **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

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

get_simulation_status(sim_id: str, **kwargs) EntityStatus[source]#

Retrieve simulation status. :param sim_id: Simulation ID :param kwargs: keyword arguments used to expand functionality

Returns:

EntityStatus

create_file(file_path: str, content: str) None[source]#

Create a file with given content and file path.

Parameters:
  • file_path – the full path of the file to be created

  • content – file content

Returns:

Nothing

static cancel_job(job_ids: str | List[str]) Any[source]#

Cancel Slurm job for given job ids. :param job_ids: slurm jobs id

Returns:

Any

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

__init__(platform: SlurmPlatform, platform_type: Type = None) None#
platform: SlurmPlatform#