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)[source]#

Bases: ABC

IPlatformExperimentOperations defines experiments item operations interface.

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

Returns the platform representation of an Experiment.

Parameters:
  • experiment_id – Item id of Experiments

  • **kwargs

Returns:

Platform Representation of an experiment

pre_create(experiment: Experiment, **kwargs) NoReturn[source]#

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: Experiment, **kwargs) NoReturn[source]#

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: Experiment, do_pre: bool = True, do_post: bool = True, **kwargs) Experiment[source]#

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 id of said item

abstract platform_create(experiment: Experiment, **kwargs) Any[source]#

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 id of said item

batch_create(experiments: List[Experiment], display_progress: bool = True, **kwargs) List[Tuple[Experiment]][source]#

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][source]#

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[source]#

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:

TopLevelItem

to_entity(experiment: Any, **kwargs) Experiment[source]#

Converts the platform representation of experiment to idmtools representation.

Parameters:

experiment – Platform experiment object

Returns:

IDMTools experiment object

pre_run_item(experiment: Experiment, **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:

experiment – Experiment to commission

Returns:

None

Raises:

ValueError - If there are no simulations

post_run_item(experiment: Experiment, **kwargs)[source]#

Trigger right after commissioning experiment on platform.

Parameters:

experiment – Experiment just commissioned

Returns:

None

run_item(experiment: Experiment, **kwargs)[source]#

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: Experiment, **kwargs)[source]#

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)[source]#

Transfer Experiment assets to the platform.

Parameters:

experiment – Experiment to send assets for

Returns:

None

abstract refresh_status(experiment: Experiment, **kwargs)[source]#

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: Experiment, files: List[str], **kwargs) Dict[str, Dict[str, bytearray]][source]#

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: Experiment, children: bool = False, **kwargs) List[Asset][source]#

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: Experiment, **kwargs) List[Asset][source]#

List the assets on an experiment.

Parameters:
  • experiment – Experiment to list.

  • **kwargs – Extra Arguments

Returns:

List of Assets

platform_modify_experiment(experiment: Experiment, regather_common_assets: bool = False, **kwargs) Experiment[source]#

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

create_sim_directory_map(experiment_id: str) Dict[source]#

Build simulation working directory mapping. :param experiment_id: experiment id

Returns:

Dict

platform_delete(experiment_id: str) None[source]#

Delete platform experiment. :param experiment_id: experiment id

Returns:

None

platform_cancel(experiment_id: str) None[source]#

Cancel platform experiment. :param experiment_id: experiment id

Returns:

None

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