idmtools_platform_comps.utils.scheduling module#

idmtools scheduling utils for comps.

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

idmtools_platform_comps.utils.scheduling.default_add_workorder_sweep_callback(simulation, file_name, file_path)[source]#

Utility function to add updated WorkOrder.json to each simulation as linked file via simulation task.

first loads original workorder file from local, then update Command field in it from each simulation object’s simulation.task.command.cmd, then write updated command to WorkOrder.json, and load this file to simulation

Parameters:
  • simulation – Simulation we are configuring

  • file_name – Filename to use

  • file_path – Path to file

Returns:

None

idmtools_platform_comps.utils.scheduling.default_add_schedule_config_sweep_callback(simulation, command: str | None = None, **config_opts)[source]#

Default callback to be used for sweeps that affect a scheduling config.

idmtools_platform_comps.utils.scheduling.scheduled(simulation: Simulation)[source]#

Determine if scheduling is defined on the simulation.

Parameters:

simulation – Simulation to check

Returns:

True if simulation.scheduling is defined and true.

idmtools_platform_comps.utils.scheduling.add_work_order(item: Experiment | Simulation | TemplatedSimulations, file_name: str = 'WorkOrder.json', file_path: str | PathLike = './WorkOrder.json')[source]#

Adds workorder.json.

Parameters:
  • item – Item to add work order to

  • file_name – Workorder file name

  • file_path – Path to file(locally)

Returns:

None

Raises:

ValueError - If experiment is empty – If item is not an experiment, simulation, or TemplatedSimulations

idmtools_platform_comps.utils.scheduling.add_schedule_config(item: Experiment | Simulation | TemplatedSimulations, command: str | None = None, **config_opts)[source]#

Add scheduling config to an Item.

Scheduling config supports adding to Experiments, Simulations, and TemplatedSimulations

Parameters:
  • item – Item to add scheduling config to

  • command – Command to run

  • **config_opts – Additional config options

config_opts details:
  • Environment: Environment variables to set in the job environment; these can be dynamically expanded

  • SingleNode (HPC only): A flag to limit all reserved cores to being on the same compute node

  • Exclusive (HPC only): A flag that controls whether nodes should be exclusively allocated to this job

  • EnableMpi (HPC or Slurm): A flag that controls whether to run the job with mpiexec

  • NodeGroupName (HPC or Slurm): The cluster node-group to commission to

  • NumCores (HPC or Slurm): The number of cores to reserve

  • NumNodes (Slurm Only): The number of nodes to schedule

  • NumProcesses (Slurm Only): The number of processes to execute

  • additionalProperties (HPC or Slurm): True or False

Returns:

None