Github user mxmrlv commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/12#discussion_r86742397
--- Diff: aria/workflows/builtin/heal.py ---
@@ -19,50 +19,49 @@
from aria import workflow
-from .uninstall import uninstall
-from .install import install
-from .workflows import relationship_tasks
+from .workflows import relationship_tasks, install_node_instance,
uninstall_node_instance
+from ..api import task
@workflow
-def heal(context, graph, node_instance_id):
+def heal(ctx, graph, node_instance_id):
"""
The heal workflow
- :param WorkflowContext context: the workflow context
+ :param WorkflowContext ctx: the workflow context
:param TaskGraph graph: the graph which will describe the workflow.
:param node_instance_id: the id of the node instance to heal
:return:
"""
- failing_node = context.storage.node_instance.get(node_instance_id)
- host_node = context.storage.node_instance.get(failing_node.host_id)
- failed_node_instance_subgraph = _get_contained_subgraph(context,
host_node)
+ failing_node = ctx.model.node_instance.get(node_instance_id)
+ host_node = ctx.model.node_instance.get(failing_node.host_id)
+ failed_node_instance_subgraph = _get_contained_subgraph(ctx, host_node)
failed_node_instance_ids = list(n.id for n in
failed_node_instance_subgraph)
- targeted_node_instances = [
- context.storage.node_instance.get(relationship_instance.target_id)
- for node_instance in failed_node_instance_subgraph
- for relationship_instance in node_instance.relationship_instances
- if relationship_instance.target_id not in failed_node_instance_ids
- ]
-
- graph.chain([
- heal_uninstall(
- context=context,
- failing_node_instances=failed_node_instance_subgraph,
- targeted_node_instances=targeted_node_instances),
- heal_install(
- context=context,
- failing_node_instances=failed_node_instance_subgraph,
- targeted_node_instances=targeted_node_instances)
- ])
+ targeted_node_instances = [node_instance for node_instance in
ctx.node_instances
+ if node_instance.id not in
failed_node_instance_ids]
+
+ uninstall_subgraph = task.WorkflowTask(
+ heal_uninstall,
+ failing_node_instances=failed_node_instance_subgraph,
+ targeted_node_instances=targeted_node_instances
+ )
+
+ install_subgraph = task.WorkflowTask(
+ heal_install,
+ failing_node_instances=failed_node_instance_subgraph,
+ targeted_node_instances=targeted_node_instances)
+
+ graph.add_tasks(uninstall_subgraph)
--- End diff --
sequence
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---