idmtools.core.interfaces.irunnable_entity module

class idmtools.core.interfaces.irunnable_entity.IRunnableEntity(_uid: uuid.UUID = None, _IItem__pre_creation_hooks: List[Callable[[ForwardRef('IItem'), ForwardRef('IPlatform')], NoneType]] = <factory>, _IItem__post_creation_hooks: List[Callable[[ForwardRef('IItem'), ForwardRef('IPlatform')], NoneType]] = <factory>, platform_id: uuid.UUID = None, _platform: 'IPlatform' = None, parent_id: uuid.UUID = None, _parent: 'IEntity' = None, status: idmtools.core.enums.EntityStatus = None, tags: Dict[str, Any] = <factory>, item_type: idmtools.core.enums.ItemType = None, _platform_object: Any = None, _IRunnableEntity__pre_run_hooks: List[Callable[[ForwardRef('IRunnableEntity'), ForwardRef('IPlatform')], NoneType]] = <factory>, _IRunnableEntity__post_run_hooks: List[Callable[[ForwardRef('IRunnableEntity'), ForwardRef('IPlatform')], NoneType]] = <factory>)

Bases: idmtools.core.interfaces.ientity.IEntity

pre_run(platform: IPlatform) → None

Called before the actual creation of the entity.

Parameters

platform – Platform item is being created on

Returns:

post_run(platform: IPlatform) → None

Called after the actual creation of the entity.

Parameters

platform – Platform item was created on

Returns:

add_pre_run_hook(hook: Callable[[IRunnableEntity, IPlatform], None])

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])

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, wait_on_done: bool = True, **run_opts) → NoReturn

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)

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:

after_done()

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