idmtools.entities.iplatform_ops.iplatform_experiment_operations module¶
IPlatformExperimentOperations defines experiment item operations interface.
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.entities.iplatform_ops.iplatform_experiment_operations.IPlatformExperimentOperations(platform: IPlatform, platform_type: Type)¶
Bases:
abc.ABC
IPlatformExperimentOperations defines experiments item operations interface.
- platform_type: Type¶
- abstract get(experiment_id: uuid.UUID, **kwargs) Any ¶
Returns the platform representation of an Experiment.
- Parameters:
experiment_id – Item id of Experiments
**kwargs –
- Returns:
Platform Representation of an experiment
- pre_create(experiment: idmtools.entities.experiment.Experiment, **kwargs) NoReturn ¶
Run the platform/experiment post creation events.
- Parameters:
experiment – Experiment to run post-creation events
**kwargs – Optional arguments mainly for extensibility
- Returns:
NoReturn
- post_create(experiment: idmtools.entities.experiment.Experiment, **kwargs) NoReturn ¶
Run the platform/experiment post creation events.
- Parameters:
experiment – Experiment to run post-creation events
**kwargs – Optional arguments mainly for extensibility
- Returns:
NoReturn
- create(experiment: idmtools.entities.experiment.Experiment, do_pre: bool = True, do_post: bool = True, **kwargs) idmtools.entities.experiment.Experiment ¶
Creates an experiment from an IDMTools simulation object.
Also performs local/platform pre and post creation events.
- Parameters:
experiment – Experiment 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(experiment: idmtools.entities.experiment.Experiment, **kwargs) Any ¶
Creates an experiment from an IDMTools experiment object.
- Parameters:
experiment – Experiment to create
**kwargs – Optional arguments mainly for extensibility
- Returns:
Created platform item and the UUID of said item
- batch_create(experiments: List[idmtools.entities.experiment.Experiment], display_progress: bool = True, **kwargs) List[Tuple[idmtools.entities.experiment.Experiment]] ¶
Provides a method to batch create experiments.
- Parameters:
experiments – List of experiments to create
display_progress – Show progress bar
**kwargs – Keyword arguments to pass to the batch
- Returns:
List of tuples containing the create object and id of item that was created
- abstract get_children(experiment: Any, **kwargs) List[Any] ¶
Returns the children of an experiment object.
- Parameters:
experiment – Experiment object
**kwargs – Optional arguments mainly for extensibility
- Returns:
Children of experiment object
- abstract get_parent(experiment: Any, **kwargs) Any ¶
Returns the parent of item. If the platform doesn’t support parents, you should throw a TopLevelItem error.
- Parameters:
experiment – Experiment to get parent from
**kwargs –
- Returns:
Parent of Experiment(Suite)
- Raises:
- to_entity(experiment: Any, **kwargs) idmtools.entities.experiment.Experiment ¶
Converts the platform representation of experiment to idmtools representation.
- Parameters:
experiment – Platform experiment object
- Returns:
IDMTools experiment object
- pre_run_item(experiment: idmtools.entities.experiment.Experiment, **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:
experiment – Experiment to commission
- Returns:
None
- Raises:
ValueError - If there are no simulations –
- post_run_item(experiment: idmtools.entities.experiment.Experiment, **kwargs)¶
Trigger right after commissioning experiment on platform.
- Parameters:
experiment – Experiment just commissioned
- Returns:
None
- run_item(experiment: idmtools.entities.experiment.Experiment, **kwargs)¶
Called during commissioning of an item. This should create the remote resource.
- Parameters:
experiment – Experiment
**kwargs – Keyword arguments to pass to pre_run_item, platform_run_item, post_run_item
- Returns:
None
- abstract platform_run_item(experiment: idmtools.entities.experiment.Experiment, **kwargs)¶
Called during commissioning of an item. This should perform what is needed to commission job on platform.
- Parameters:
experiment –
- Returns:
None
- abstract send_assets(experiment: Any, **kwargs)¶
Transfer Experiment assets to the platform.
- Parameters:
experiment – Experiment to send assets for
- Returns:
None
- abstract refresh_status(experiment: idmtools.entities.experiment.Experiment, **kwargs)¶
Refresh status for experiment object.
This should update the object directly. For experiments it is best if all simulation states are updated as well.
- Parameters:
experiment – Experiment to get status for
- Returns:
None
- get_assets(experiment: idmtools.entities.experiment.Experiment, files: List[str], **kwargs) Dict[str, Dict[str, bytearray]] ¶
Get files from experiment.
- Parameters:
experiment – Experiment to get files from
files – List files
**kwargs –
- Returns:
Dict with each sim id and the files contents matching specified list
- list_assets(experiment: idmtools.entities.experiment.Experiment, children: bool = False, **kwargs) List[idmtools.assets.asset.Asset] ¶
List available assets for a experiment.
- Parameters:
experiment – Experiment to list files for
children – Should we load assets from children as well?
- Returns:
List of Assets
- platform_list_asset(experiment: idmtools.entities.experiment.Experiment, **kwargs) List[idmtools.assets.asset.Asset] ¶
List the assets on an experiment.
- Parameters:
experiment – Experiment to list.
**kwargs – Extra Arguments
- Returns:
List of Assets
- platform_modify_experiment(experiment: idmtools.entities.experiment.Experiment, regather_common_assets: bool = False, **kwargs) idmtools.entities.experiment.Experiment ¶
API to allow detection of experiments already created.
- Parameters:
experiment –
regather_common_assets – When modifying, should we gather assets from template/simulations. It is important to note that when using this feature, ensure the previous simulations have finished provisioning. Failure to do so can lead to unexpected behaviour
- Returns:
Experiment updated