idmtools.entities.simulation module

Defines our Simulation object.

The simulation object can be thought as a metadata object. It represents a configuration of a remote job execution metadata. All simulations have a task. Optionally that have assets. All simulations should belong to an Experiment.

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

class idmtools.entities.simulation.Simulation(_uid: str = None, _IItem__pre_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _IItem__post_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, platform_id: str = None, _platform: IPlatform = None, parent_id: str = None, _parent: IEntity = None, status: ~idmtools.core.enums.EntityStatus = None, tags: ~typing.Dict[str, ~typing.Any] = <factory>, item_type: ~idmtools.core.enums.ItemType = ItemType.SIMULATION, _platform_object: ~typing.Any = None, name: str = None, assets: ~idmtools.assets.asset_collection.AssetCollection = <factory>, task: ITask = None, _Simulation__assets_gathered: bool = False, _platform_kwargs: dict = <factory>)[source]

Bases: IAssetsEnabled, INamedEntity

Class that represents a generic simulation.

This class needs to be implemented for each model type with specifics.

task: ITask = None

Task representing the configuration of the command to be executed

item_type: ItemType = 'Simulation'

Item Type. Should not be changed from Simulation

property experiment: Experiment

Get experiment parent.

Returns:

Parent Experiment

pre_creation(platform: IPlatform)[source]

Runs before a simulation is created server side.

Parameters:

platform – Platform the item is being executed on

Returns:

None

post_creation(platform: IPlatform) None[source]

Called after a simulation is created.

Parameters:

platform – Platform simulation is being executed on

Returns:

None

pre_getstate()[source]

Return default values for pickle_ignore_fields(). Call before pickling.

gather_assets()[source]

Gather all the assets for the simulation.

classmethod from_task(task: ITask, tags: Dict[str, Any] = None, asset_collection: AssetCollection = None)[source]

Create a simulation from a task.

Parameters:
  • task – Task to create from

  • tags – Tags to create on the simulation

  • asset_collection – Simulation Assets

Returns:

Simulation using the parameters provided

list_static_assets(platform: IPlatform = None, **kwargs) List[Asset][source]

List assets that have been uploaded to a server already.

Parameters:
  • platform – Optional platform to load assets list from

  • **kwargs

Returns:

List of assets

Raises:

ValueError - If you try to list an assets for an simulation that hasn't been created/loaded from a remote platform.

to_dict() Dict[source]

Do a lightweight conversation to json.

Returns:

Dict representing json of object

__init__(_uid: str = None, _IItem__pre_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, _IItem__post_creation_hooks: ~typing.List[~typing.Callable[[IItem, IPlatform], None]] = <factory>, platform_id: str = None, _platform: IPlatform = None, parent_id: str = None, _parent: IEntity = None, status: ~idmtools.core.enums.EntityStatus = None, tags: ~typing.Dict[str, ~typing.Any] = <factory>, item_type: ~idmtools.core.enums.ItemType = ItemType.SIMULATION, _platform_object: ~typing.Any = None, name: str = None, assets: ~idmtools.assets.asset_collection.AssetCollection = <factory>, task: ITask = None, _Simulation__assets_gathered: bool = False, _platform_kwargs: dict = <factory>) None