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)¶
Bases:
idmtools.core.cache_enabled.CacheEnabled
,abc.ABC
IPlatformSimulationOperations defines simulation item operations interface.
- platform_type: Type¶
- abstract get(simulation_id: uuid.UUID, **kwargs) Any ¶
Returns the platform representation of an Simulation.
- Parameters:
simulation_id – Item id of Simulations
**kwargs –
- Returns:
Platform Representation of an simulation
- pre_create(simulation: idmtools.entities.simulation.Simulation, **kwargs) NoReturn ¶
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: idmtools.entities.simulation.Simulation, **kwargs) NoReturn ¶
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: idmtools.entities.simulation.Simulation, do_pre: bool = True, do_post: bool = True, **kwargs) Any ¶
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 UUID of said item
- abstract platform_create(simulation: idmtools.entities.simulation.Simulation, **kwargs) Any ¶
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 UUID of said item
- batch_create(sims: List[idmtools.entities.simulation.Simulation], display_progress: bool = True, **kwargs) List[idmtools.entities.simulation.Simulation] ¶
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 ¶
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:
- to_entity(simulation: Any, load_task: bool = False, parent: Optional[idmtools.entities.experiment.Experiment] = None, **kwargs) idmtools.entities.simulation.Simulation ¶
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: idmtools.entities.simulation.Simulation, **kwargs)¶
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: idmtools.entities.simulation.Simulation, **kwargs)¶
Trigger right after commissioning experiment on platform.
- Parameters:
simulation – Experiment just commissioned
- Returns:
None
- run_item(simulation: idmtools.entities.simulation.Simulation, **kwargs)¶
Called during commissioning of an item. This should create the remote resource.
- Parameters:
simulation –
- Returns:
None
- abstract platform_run_item(simulation: idmtools.entities.simulation.Simulation, **kwargs)¶
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)¶
Send simulations assets to server.
- Parameters:
simulation – Simulation to upload assets for
**kwargs – Keyword arguments for the op
- Returns:
None
- abstract refresh_status(simulation: idmtools.entities.simulation.Simulation, **kwargs)¶
Refresh status for simulation object.
- Parameters:
simulation – Experiment to get status for
- Returns:
None
- abstract get_assets(simulation: idmtools.entities.simulation.Simulation, files: List[str], **kwargs) Dict[str, bytearray] ¶
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: idmtools.entities.simulation.Simulation, **kwargs) List[idmtools.assets.asset.Asset] ¶
List available assets for a simulation.
- Parameters:
simulation – Simulation of assets Assets
- Returns:
List of filenames