idmtools.entities.iplatform_ops.iplatform_simulation_operations module#

IPlatformSimulationOperations defines simulation item operations interface.

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

class idmtools.entities.iplatform_ops.iplatform_simulation_operations.IPlatformSimulationOperations(platform: IPlatform, platform_type: Type)[source]#

Bases: CacheEnabled, ABC

IPlatformSimulationOperations defines simulation item operations interface.

platform: IPlatform#
platform_type: Type#
abstract get(simulation_id: str, **kwargs) Any[source]#

Returns the platform representation of an Simulation.

Parameters:
  • simulation_id – Item id of Simulations

  • **kwargs

Returns:

Platform Representation of an simulation

pre_create(simulation: Simulation, **kwargs) NoReturn[source]#

Run the platform/simulation post creation events.

Parameters:
  • simulation – simulation to run post-creation events

  • **kwargs – Optional arguments mainly for extensibility

Returns:

NoReturn

post_create(simulation: Simulation, **kwargs) NoReturn[source]#

Run the platform/simulation post creation events.

Parameters:
  • simulation – simulation to run post-creation events

  • **kwargs – Optional arguments mainly for extensibility

Returns:

NoReturn

create(simulation: Simulation, do_pre: bool = True, do_post: bool = True, **kwargs) Any[source]#

Creates an simulation from an IDMTools simulation object.

Also performs pre-creation and post-creation locally and on platform.

Parameters:
  • simulation – Simulation to create

  • do_pre – Perform Pre creation events for item

  • do_post – Perform Post creation events for item

  • **kwargs – Optional arguments mainly for extensibility

Returns:

Created platform item and the id of said item

abstract platform_create(simulation: Simulation, **kwargs) Any[source]#

Creates an simulation on Platform from an IDMTools Simulation Object.

Parameters:
  • simulation – Simulation to create

  • **kwargs – Optional arguments mainly for extensibility

Returns:

Created platform item and the id of said item

batch_create(sims: List[Simulation], display_progress: bool = True, **kwargs) List[Simulation][source]#

Provides a method to batch create simulations.

Parameters:
  • sims – List of simulations to create

  • display_progress – Show progress bar

  • **kwargs

Returns:

List of tuples containing the create object and id of item that was created

abstract get_parent(simulation: Any, **kwargs) Any[source]#

Returns the parent of item. If the platform doesn’t support parents, you should throw a TopLevelItem error.

Parameters:
  • simulation

  • **kwargs

Returns:

Parent of simulation

Raises:

TopLevelItem

to_entity(simulation: Any, load_task: bool = False, parent: Experiment | None = None, **kwargs) Simulation[source]#

Converts the platform representation of simulation to idmtools representation.

Parameters:
  • simulation – Platform simulation object

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

  • parent – Optional parent object

Returns:

IDMTools simulation object

pre_run_item(simulation: Simulation, **kwargs)[source]#

Trigger right before commissioning experiment on platform.

This ensures that the item is created. It also ensures that the children(simulations) have also been created.

Parameters:

simulation – Experiment to commission

Returns:

None

post_run_item(simulation: Simulation, **kwargs)[source]#

Trigger right after commissioning experiment on platform.

Parameters:

simulation – Experiment just commissioned

Returns:

None

run_item(simulation: Simulation, **kwargs)[source]#

Called during commissioning of an item. This should create the remote resource.

Parameters:

simulation

Returns:

None

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

Called during commissioning of an item. This should create the remote resource but not upload assets.

Parameters:

simulation – Simulation to run

Returns:

None

abstract send_assets(simulation: Any, **kwargs)[source]#

Send simulations assets to server.

Parameters:
  • simulation – Simulation to upload assets for

  • **kwargs – Keyword arguments for the op

Returns:

None

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

Refresh status for simulation object.

Parameters:

simulation – Experiment to get status for

Returns:

None

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

Get files from simulation.

Parameters:
  • simulation – Simulation to fetch files from

  • files – Files to get

  • **kwargs

Returns:

Dictionary containing filename and content

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

List available assets for a simulation.

Parameters:

simulation – Simulation of Assets

Returns:

List of filenames

create_sim_directory_map(simulation_id: str) Dict[source]#

Build simulation working directory mapping. :param simulation_id: simulation id

Returns:

Dict

platform_delete(simulation_id: str) None[source]#

Delete platform simulation. :param simulation_id: simulation id

Returns:

None

platform_cancel(simulation_id: str) None[source]#

Cancel platform simulation. :param simulation_id: simulation id

Returns:

None

__init__(platform: IPlatform, platform_type: Type) None#