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)
-
target_id
¶ The relationship target node id
-
target_node_instance
¶ The relationship’s target node CloudifyWorkflowNodeInstance instance
-
relationship
¶ The relationship object for this relationship instance
-
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)
-
target_id
¶ The relationship target node id
-
target_node
¶ The relationship target node WorkflowContextNode instance
-
source_operations
¶ The relationship source operations
-
target_operations
¶ The relationship target operations
-
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
-
execute_operation
(operation, kwargs=None, allow_kwargs_override=False, send_task_events=True)[source]¶ Execute a node operation
Parameters: - operation – The node operation
- kwargs – optional kwargs to be passed to the called operation
-
id
¶ The node instance id
-
node_id
¶ The node id (this instance is an instance of that node)
-
relationships
¶ The node relationships
-
node
¶ The node object for this node instance
-
modification
¶ Modification enum (None, added, removed)
-
logger
¶ A logger for this workflow node
-
contained_instances
¶ Returns node instances directly contained in this instance (children)
-
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
-
id
¶ The node id
-
type
¶ The node type
-
type_hierarchy
¶ The node type hierarchy
-
properties
¶ The node properties
-
plugins_to_install
¶ The plugins to install in this node. (Only relevant for host nodes)
-
host_id
¶
-
host_node
¶
-
number_of_instances
¶
-
relationships
¶ The node relationships
-
operations
¶ The node operations
-
instances
¶ The node instances
-
class
cloudify.workflows.workflow_context.
WorkflowNodesAndInstancesContainer
(workflow_context, raw_nodes, raw_node_instances)[source]¶ Bases:
object
-
nodes
¶
-
node_instances
¶
-
-
class
cloudify.workflows.workflow_context.
CloudifyWorkflowContext
(ctx)[source]¶ Bases:
cloudify.workflows.workflow_context._WorkflowContextBase
,cloudify.workflows.workflow_context.WorkflowNodesAndInstancesContainer
A context used in workflow operations
Parameters: ctx – a cloudify_context workflow dict
-
class
cloudify.workflows.workflow_context.
CloudifySystemWideWorkflowContext
(ctx)[source]¶ Bases:
cloudify.workflows.workflow_context._WorkflowContextBase
An instance of this class gets passed as the
ctx
parameter to a workflow method decorated with@workflow(system_wide=True)
. This context is not particularly bound to any specific deployment. It provides adeployments_contexts
property, which is a lazily loaded dictionary, whose keys are deployment ids and values are lazily loaded (thanks toproxy_tools.proxy
) deployment contexts corresponding to those deployments. For example, in order to make use of any functionality provided by theCloudifyWorkflowContext
class for a deployment “dep1”, the code should look like this:Example:
with ctx.deployments_contexts['dep1'] as dep: for node_instance in dep.node_instances: pass
-
deployments_contexts
¶
-
-
class
cloudify.workflows.workflow_context.
LocalTasksProcessing
(thread_pool_size=1)[source]¶ Bases:
object
-
class
cloudify.workflows.workflow_context.
CloudifyWorkflowContextHandler
(workflow_ctx)[source]¶ Bases:
object
-
bootstrap_context
¶
-
operation_cloudify_context
¶
-
-
class
cloudify.workflows.workflow_context.
RemoteContextHandler
(workflow_ctx)[source]¶ Bases:
cloudify.workflows.workflow_context.CloudifyWorkflowContextHandler
-
bootstrap_context
¶
-
operation_cloudify_context
¶
-
-
class
cloudify.workflows.workflow_context.
RemoteCloudifyWorkflowContextHandler
(workflow_ctx)[source]¶ Bases:
cloudify.workflows.workflow_context.RemoteContextHandler
-
class
cloudify.workflows.workflow_context.
SystemWideWfRemoteContextHandler
(workflow_ctx)[source]¶ Bases:
cloudify.workflows.workflow_context.RemoteContextHandler
-
class
cloudify.workflows.workflow_context.
LocalCloudifyWorkflowContextHandler
(workflow_ctx, storage)[source]¶ Bases:
cloudify.workflows.workflow_context.CloudifyWorkflowContextHandler
-
bootstrap_context
¶
-
operation_cloudify_context
¶
-
-
class
cloudify.workflows.workflow_context.
Modification
(workflow_ctx, modification)[source]¶ Bases:
object
-
added
¶ Returns: Added and related nodes Return type: ModificationNodes
-
removed
¶ Returns: Removed and related nodes Return type: ModificationNodes
-
id
¶
-
-
class
cloudify.workflows.workflow_context.
ModificationNodes
(modification, raw_nodes, raw_node_instances)[source]¶ Bases:
cloudify.workflows.workflow_context.WorkflowNodesAndInstancesContainer
-
class
cloudify.workflows.workflow_context.
WorkflowDeploymentContext
(cloudify_context, workflow_ctx)[source]¶ Bases:
cloudify.context.DeploymentContext
-
start_modification
(nodes)[source]¶ Start deployment modification process
Parameters: nodes – Modified nodes specification Returns: Workflow modification wrapper Return type: Modification
-