idmtools_platform_local.platform_operations.simulation_operations module

idmtools local platform simulation operations.

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

class idmtools_platform_local.platform_operations.simulation_operations.LocalPlatformSimulationOperations(platform: LocalPlatform, platform_type: type = <class 'idmtools_platform_local.platform_operations.utils.SimulationDict'>)[source]

Bases: IPlatformSimulationOperations

Provides Simulation Operations to the Local Platform.

platform: LocalPlatform
platform_type

alias of SimulationDict

get(simulation_id: UUID, **kwargs) Dict[source]

Fetch simulation with specified id.

Parameters:
  • simulation_id – simulation id

  • **kwargs

Returns:

SimulationDIct

platform_create(simulation: Simulation, **kwargs) Dict[source]

Create a simulation object.

Parameters:
  • simulation – Simulation to create

  • **kwargs

Returns:

Simulation dict and created id

batch_create(sims: List[Simulation], **kwargs) List[SimulationDict][source]

Batch creation of simulations.

This is optimized by bulk uploading assets after creating of all the assets

Parameters:
  • sims – List of sims to create

  • **kwargs

Returns:

List of SimulationDict object and their IDs

get_parent(simulation: SimulationDict, **kwargs) ExperimentDict[source]

Get the parent of a simulation, aka its experiment.

Parameters:
  • simulation – Simulation to get parent from

  • **kwargs

Returns:

ExperimentDict object

platform_run_item(simulation: Simulation, **kwargs)[source]

On the local platform, simulations are ran by queue and commissioned through create.

Parameters:

simulation

Returns:

None

send_assets(simulation: Simulation, worker: Container | None = None, **kwargs)[source]

Transfer assets to local sim folder for simulation.

Parameters:
  • simulation – Simulation object

  • worker – docker worker containers. Useful in batches

Returns:

None

refresh_status(simulation: Simulation, **kwargs)[source]

Refresh status of a sim.

Parameters:

simulation

Returns:

None

get_assets(simulation: Simulation, files: List[str], **kwargs) Dict[str, bytearray][source]

Get assets for a specific simulation.

Parameters:
  • simulation – Simulation object to fetch files for

  • files – List of files to fetch

Returns:

Returns a dict containing mapping of filename->bytearry

list_assets(simulation: Simulation, **kwargs) List[Asset][source]

List assets for a sim.

Parameters:

simulation – Simulation object

Returns:

List of assets

to_entity(local_sim: Dict, load_task: bool = False, parent: Experiment | None = None, **kwargs) Simulation[source]

Convert a sim dict object to an ISimulation.

Parameters:
  • local_sim – simulation to convert

  • load_task – Load Task Object as well. Can take much longer and have more data on platform

  • parent – optional experiment object

  • **kwargs

Returns:

ISimulation object

__init__(platform: LocalPlatform, platform_type: type = <class 'idmtools_platform_local.platform_operations.utils.SimulationDict'>) None