Workflow Context¶
- class cloudify.workflows.workflow_context.CloudifyWorkflowRelationshipInstance(ctx, node_instance, nodes_and_instances, relationship_instance)[source]¶
Bases: object
A node instance relationship instance
Parameters: - ctx – a CloudifyWorkflowContext instance
- node_instance – a CloudifyWorkflowNodeInstance instance
- nodes_and_instances – a WorkflowNodesAndInstancesContainer instance
- relationship_instance – A relationship dict from a NodeInstance instance (of the rest client model)
- class cloudify.workflows.workflow_context.CloudifyWorkflowRelationship(ctx, node, nodes_and_instances, relationship)[source]¶
Bases: object
A node relationship
Parameters: - ctx – a CloudifyWorkflowContext instance
- node – a CloudifyWorkflowNode instance
- nodes_and_instances – a WorkflowNodesAndInstancesContainer instance
- relationship – a relationship dict from a Node instance (of the rest client mode)
- class cloudify.workflows.workflow_context.CloudifyWorkflowNodeInstance(ctx, node, node_instance, nodes_and_instances)[source]¶
Bases: object
A plan node instance
Parameters: - ctx – a CloudifyWorkflowContext instance
- node – a CloudifyWorkflowContextNode instance
- node_instance – a NodeInstance (rest client response model)
- nodes_and_instances – a WorkflowNodesAndInstancesContainer instance
- set_state(state)[source]¶
Set the node state
Parameters: state – The node state Returns: the state set
- send_event(event, additional_context=None)[source]¶
Sends a workflow node event to RabbitMQ
Parameters: - event – The event
- additional_context – additional context to be added to the context
- class cloudify.workflows.workflow_context.CloudifyWorkflowNode(ctx, node, nodes_and_instances)[source]¶
Bases: object
A plan node instance
Parameters: - ctx – a CloudifyWorkflowContext instance
- node – a Node instance (rest client response model)
- nodes_and_instances – a WorkflowNodesAndInstancesContainer instance
- class cloudify.workflows.workflow_context.WorkflowNodesAndInstancesContainer(workflow_context, raw_nodes, raw_node_instances)[source]¶
Bases: object
- class cloudify.workflows.workflow_context.CloudifyWorkflowContext(ctx)[source]¶
Bases: cloudify.workflows.workflow_context.WorkflowNodesAndInstancesContainer
A context used in workflow operations
Parameters: ctx – a cloudify_context workflow dict - graph_mode()[source]¶
Switch the workflow context into graph mode
Returns: A task dependency graph instance
- send_event(event, event_type='workflow_stage', args=None, additional_context=None)[source]¶
Sends a workflow event to RabbitMQ
Parameters: - event – The event
- event_type – The event type
- args – additional arguments that may be added to the message
- additional_context – additional context to be added to the context
- update_execution_status(new_status)[source]¶
Updates the execution status to new_status. Note that the workflow status gets automatically updated before and after its run (whether the run succeeded or failed)
- execute_task(task_name, task_queue=None, kwargs=None, node_context=None, send_task_events=True)[source]¶
Execute a task
Parameters: - task_name – the task named
- task_queue – the task queue, if None runs the task locally
- kwargs – optional kwargs to be passed to the task
- node_context – Used internally by node.execute_operation
- local_task(local_task, node=None, info=None, kwargs=None, task_id=None, name=None, send_task_events=True, override_task_config=False)[source]¶
Create a local workflow task
Parameters: - local_task – A callable implementation for the task
- node – A node if this task is called in a node context
- info – Additional info that will be accessed and included in log messages
- kwargs – kwargs to pass to the local_task when invoked
- task_id – The task id
- class cloudify.workflows.workflow_context.LocalTasksProcessing(thread_pool_size=1)[source]¶
Bases: object
- class cloudify.workflows.workflow_context.CloudifyWorkflowContextHandler(workflow_ctx)[source]¶
Bases: object
- class cloudify.workflows.workflow_context.RemoteCloudifyWorkflowContextHandler(workflow_ctx)[source]¶
Bases: cloudify.workflows.workflow_context.CloudifyWorkflowContextHandler
- class cloudify.workflows.workflow_context.LocalCloudifyWorkflowContextHandler(workflow_ctx, storage)[source]¶
Bases: cloudify.workflows.workflow_context.CloudifyWorkflowContextHandler
- class cloudify.workflows.workflow_context.Modification(workflow_ctx, modification)[source]¶
Bases: object
- class cloudify.workflows.workflow_context.ModificationNodes(modification, raw_nodes, raw_node_instances)[source]¶
Bases: cloudify.workflows.workflow_context.WorkflowNodesAndInstancesContainer