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: uuid.UUID = 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: uuid.UUID = None, _platform: IPlatform = None, parent_id: uuid.UUID = 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>)

Bases: idmtools.core.interfaces.iassets_enabled.IAssetsEnabled, idmtools.core.interfaces.inamed_entity.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: idmtools.core.enums.ItemType = 'Simulation'

Item Type. Should not be changed from Simulation

property experiment: Experiment

Get experiment parent.

Returns:

Parent Experiment

pre_creation(platform: IPlatform)

Runs before a simulation is created server side.

Parameters:

platform – Platform the item is being executed on

Returns:

None

post_creation(platform: IPlatform) None

Called after a simulation is created.

Parameters:

platform – Platform simulation is being executed on

Returns:

None

pre_getstate()

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

gather_assets()

Gather all the assets for the simulation.

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

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[idmtools.assets.asset.Asset]

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

Do a lightweight conversation to json.

Returns:

Dict representing json of object

__init__(_uid: uuid.UUID = 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: uuid.UUID = None, _platform: IPlatform = None, parent_id: uuid.UUID = 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