idmtools.core.interfaces.irunnable_entity module#
IRunnableEntity definition. IRunnableEntity defines items that can be ran using platform.run().
Copyright 2021, Bill & Melinda Gates Foundation. All rights reserved.
- class idmtools.core.interfaces.irunnable_entity.IRunnableEntity(_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 = None, _platform_object: ~typing.Any = None, _IRunnableEntity__pre_run_hooks: ~typing.List[~typing.Callable[[IRunnableEntity, IPlatform], None]] = <factory>, _IRunnableEntity__post_run_hooks: ~typing.List[~typing.Callable[[IRunnableEntity, IPlatform], None]] = <factory>)[source]#
Bases:
IEntity
IRunnableEntity are items that can be ran on platforms like Experiments or WorkItems.
IRunnableEntity also add pre and post run hooks available to the IEntity class.
- pre_run(platform: IPlatform) None [source]#
Called before the actual creation of the entity.
- Parameters:
platform – Platform item is being created on
- Returns:
None
- post_run(platform: IPlatform) None [source]#
Called after the actual creation of the entity.
- Parameters:
platform – Platform item was created on
- Returns:
None
- add_pre_run_hook(hook: Callable[[IRunnableEntity, IPlatform], None])[source]#
Adds a hook function to be called before an item is ran.
- Parameters:
hook – Hook function. This should have two arguments, the item and the platform
- Returns:
None
- add_post_run_hook(hook: Callable[[IRunnableEntity, IPlatform], None])[source]#
Adds a hook function to be called after an item has ran.
- Parameters:
hook – Hook function. This should have two arguments, the item and the platform
- Returns:
None
- run(wait_until_done: bool = False, platform: IPlatform = None, wait_on_done_progress: bool = True, **run_opts) NoReturn [source]#
Runs an item.
- Parameters:
wait_until_done – Whether we should wait on item to finish running as well. Defaults to False
platform – Platform object to use. If not specified, we first check object for platform object then the current context
wait_on_done_progress – Defaults to true
**run_opts – Options to pass to the platform
- Returns:
None
- wait(wait_on_done_progress: bool = True, timeout: int = None, refresh_interval=None, platform: IPlatform = None, **kwargs)[source]#
Wait on an item to finish running.
- Parameters:
wait_on_done_progress – Should we show progress as we wait?
timeout – Timeout to wait
refresh_interval – How often to refresh object
platform – Platform. If not specified, we try to determine this from context
- Returns:
None
- after_done()[source]#
Run after an item is done after waiting. Currently we call the on succeeded and on failure plugins.
- Returns:
Runs after an item is done after waiting
- __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 = None, _platform_object: ~typing.Any = None, _IRunnableEntity__pre_run_hooks: ~typing.List[~typing.Callable[[IRunnableEntity, IPlatform], None]] = <factory>, _IRunnableEntity__post_run_hooks: ~typing.List[~typing.Callable[[IRunnableEntity, IPlatform], None]] = <factory>) None #