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, node_group: str | None = None, num_cores: int = 1, **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, node_group: str | None = None, num_cores: int = 1, **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

  • node_group – Node group name

  • num_cores – Num of cores to use

  • **config_opts – Additional config options

Returns:

None

Raises:

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

Notes

  • TODO refactor to reuse the add_work_order if possible. The complication is simulation command possibly