idmtools.entities.iplatform_ops.iplatform_workflowitem_operations module

IPlatformWorkflowItemOperations defines workflow item operations interface.

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

class idmtools.entities.iplatform_ops.iplatform_workflowitem_operations.IPlatformWorkflowItemOperations(platform: IPlatform, platform_type: Type)

Bases: CacheEnabled, ABC

IPlatformWorkflowItemOperations defines workflow item operations interface.

platform: IPlatform
platform_type: Type
abstract get(workflow_item_id: UUID, **kwargs) Any

Returns the platform representation of an WorkflowItem.

Parameters:
  • workflow_item_id – Item id of WorkflowItems

  • **kwargs

Returns:

Platform Representation of an workflow_item

batch_create(workflow_items: List[IWorkflowItem], display_progress: bool = True, **kwargs) List[Any]

Provides a method to batch create workflow items.

Parameters:
  • workflow_items – List of worfklow items to create

  • display_progress – Whether to display progress bar

  • **kwargs

Returns:

List of tuples containing the create object and id of item that was created.

pre_create(workflow_item: IWorkflowItem, **kwargs) NoReturn

Run the platform/workflow item post creation events.

Parameters:
  • workflow_item – IWorkflowItem to run post-creation events

  • **kwargs – Optional arguments mainly for extensibility

Returns:

NoReturn

post_create(workflow_item: IWorkflowItem, **kwargs) NoReturn

Run the platform/workflow item post creation events.

Parameters:
  • workflow_item – IWorkflowItem to run post-creation events

  • **kwargs – Optional arguments mainly for extensibility

Returns:

NoReturn

create(workflow_item: IWorkflowItem, do_pre: bool = True, do_post: bool = True, **kwargs) Any

Creates an workflow item from an IDMTools IWorkflowItem object.

Also performs pre-creation and post-creation locally and on platform.

Parameters:
  • workflow_item – Suite 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 UUID of said item

abstract platform_create(workflow_item: IWorkflowItem, **kwargs) Tuple[Any, UUID]

Creates an workflow_item from an IDMTools workflow_item object.

Parameters:
  • workflow_item – WorkflowItem to create

  • **kwargs – Optional arguments mainly for extensibility

Returns:

Created platform item and the UUID of said item

pre_run_item(workflow_item: IWorkflowItem, **kwargs)

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:

workflow_item – Experiment to commission

Returns:

None

post_run_item(workflow_item: IWorkflowItem, **kwargs)

Trigger right after commissioning workflow item on platform.

Parameters:

workflow_item – Experiment just commissioned

Returns:

None

run_item(workflow_item: IWorkflowItem, **kwargs)

Called during commissioning of an item. This should create the remote resource.

Parameters:

workflow_item

Returns:

None

abstract platform_run_item(workflow_item: IWorkflowItem, **kwargs)

Called during commissioning of an item. This should perform what is needed to commission job on platform.

Parameters:

workflow_item

Returns:

None

abstract get_parent(workflow_item: Any, **kwargs) Any

Returns the parent of item. If the platform doesn’t support parents, you should throw a TopLevelItem error.

Parameters:
  • workflow_item – Workflow item to get parent of

  • **kwargs

Returns:

Parent of Worktflow item

Raises:

TopLevelItem

abstract get_children(workflow_item: Any, **kwargs) List[Any]

Returns the children of an workflow_item object.

Parameters:
  • workflow_item – WorkflowItem object

  • **kwargs – Optional arguments mainly for extensibility

Returns:

Children of workflow_item object

to_entity(workflow_item: Any, **kwargs) IWorkflowItem

Converts the platform representation of workflow_item to idmtools representation.

Parameters:

workflow_item – Platform workflow_item object

Returns:

IDMTools workflow_item object

abstract refresh_status(workflow_item: IWorkflowItem, **kwargs)

Refresh status for workflow item.

Parameters:

workflow_item – Item to refresh status for

Returns:

None

abstract send_assets(workflow_item: Any, **kwargs)

Send assets for workflow item to platform.

Parameters:

workflow_item – Item to send assets for

Returns:

None

abstract get_assets(workflow_item: IWorkflowItem, files: List[str], **kwargs) Dict[str, bytearray]

Load assets for workflow item.

Parameters:
  • workflow_item – Item

  • files – List of files to load

  • **kwargs

Returns:

Dictionary with filename as key and value as binary content

abstract list_assets(workflow_item: IWorkflowItem, **kwargs) List[Asset]

List available assets for a workflow item.

Parameters:

workflow_item – workflow item to list files for

Returns:

List of filenames

__init__(platform: IPlatform, platform_type: Type) None