[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-04 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-ariatosca/pull/117


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-04 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114758119
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -170,6 +169,10 @@ def __init__(self, api_task, executor=None, *args, 
**kwargs):
 self._task_id = task_model.id
 self._update_fields = None
 
+def execute(self):
+self._executor._task_sent(self)
--- End diff --

move back to engine


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-04 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114760771
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -161,6 +141,27 @@ def __getattr__(self, item):
 return super(WorkflowTask, self).__getattribute__(item)
 
 
+def create_task(actor, interface_name, operation_name, **kwargs):
+"""
+This helper function enables safe creation of OperationTask, if the 
supplied interface and
--- End diff --

fix the comment


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-04 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114761560
  
--- Diff: aria/orchestrator/workflows/events_logging.py ---
@@ -36,16 +36,15 @@ def _get_task_name(task):
 @events.start_task_signal.connect
 def _start_task_handler(task, **kwargs):
 # If the task has not implementation this is an empty task.
-if task.implementation:
-task.context.logger.debug('{name} 
{task.interface_name}.{task.operation_name} has no '
-  
'implementation'.format(name=_get_task_name(task), task=task))
-else:
-task.context.logger.info('{name} 
{task.interface_name}.{task.operation_name} started...'
- .format(name=_get_task_name(task), 
task=task))
+suffix = 'started...' if task.implementation else 'has no 
implementation'
+task.context.logger.debug('{name} 
{task.interface_name}.{task.operation_name} {suffix}'
--- End diff --

task.imp -> info


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-04 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114760148
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -72,63 +72,43 @@ def __init__(self,
 Do not call this constructor directly. Instead, use 
:meth:`for_node` or
 :meth:`for_relationship`.
 """
-
-actor_type = type(actor).__name__.lower()
 assert isinstance(actor, (models.Node, models.Relationship))
-assert actor_type in ('node', 'relationship')
-assert interface_name and operation_name
 super(OperationTask, self).__init__()
-
 self.actor = actor
-self.max_attempts = (self.workflow_context._task_max_attempts
- if max_attempts is None else max_attempts)
-self.retry_interval = (self.workflow_context._task_retry_interval
-   if retry_interval is None else 
retry_interval)
-self.ignore_failure = (self.workflow_context._task_ignore_failure
-   if ignore_failure is None else 
ignore_failure)
 self.interface_name = interface_name
 self.operation_name = operation_name
-self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
+self.max_attempts = max_attempts or 
self.workflow_context._task_max_attempts
+self.retry_interval = retry_interval or 
self.workflow_context._task_retry_interval
+self.ignore_failure = ignore_failure or 
self.workflow_context._task_ignore_failure
--- End diff --

revert


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114545381
  
--- Diff: 
extensions/aria_extension_tosca/profiles/tosca-simple-1.0/interfaces.yaml ---
@@ -82,14 +82,14 @@ interface_types:
 relationship_edge: target
 add_target:
   description: >-
-Operation to notify the source node of a target node being added 
via a relationship.
--- End diff --

talk to tal but i think youre wrong sorry bro bruh


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114544120
  
--- Diff: aria/orchestrator/workflows/executor/base.py ---
@@ -40,6 +40,10 @@ def close(self):
 pass
 
 @staticmethod
+def _task_sent(task):
--- End diff --

remove


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114545574
  
--- Diff: tests/end2end/test_hello_world.py ---
@@ -57,5 +57,5 @@ def _verify_deployed_service_in_storage(service_name, 
model_storage):
 assert service.name == service_name
 assert len(service.executions) == 1
 assert len(service.nodes) == 2
-# TODO: validate node states
--- End diff --

also remove `force_service_delete`


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114536595
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -108,15 +119,18 @@ class OperationTask(BaseTask):
 """
 Operation task
 """
+def __init__(self, api_task, executor=None, *args, **kwargs):
+# If no executor is provided, we defer that this is a stub task 
which does not need to be
+# executed.
+super(OperationTask, self).__init__(
+id=api_task.id, executor=executor or 
base.EmptyOperationExecutor(), *args, **kwargs)
 
-def __init__(self, api_task, *args, **kwargs):
-super(OperationTask, self).__init__(id=api_task.id, **kwargs)
 self._workflow_context = api_task._workflow_context
 self.interface_name = api_task.interface_name
 self.operation_name = api_task.operation_name
 model_storage = api_task._workflow_context.model
-plugin = api_task.plugin
 
+# This currently signal that this is a stub task
--- End diff --

remove


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114544771
  
--- Diff: aria/orchestrator/workflows/executor/base.py ---
@@ -50,3 +54,15 @@ def _task_failed(task, exception, traceback=None):
 @staticmethod
 def _task_succeeded(task):
 events.on_success_task_signal.send(task)
+
+
+class StubExecutor(BaseExecutor):
--- End diff --

stubtask


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114537215
  
--- Diff: aria/orchestrator/workflows/core/translation.py ---
@@ -48,21 +49,22 @@ def build_execution_graph(
 default=[start_task])
 
 if isinstance(api_task, api.task.OperationTask):
-# Add the task an the dependencies
-operation_task = core_task.OperationTask(api_task)
+if api_task.is_stub:
--- End diff --

is_empty


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114537810
  
--- Diff: aria/orchestrator/workflows/core/translation.py ---
@@ -48,21 +49,22 @@ def build_execution_graph(
 default=[start_task])
 
 if isinstance(api_task, api.task.OperationTask):
-# Add the task an the dependencies
-operation_task = core_task.OperationTask(api_task)
+if api_task.is_stub:
+operation_task = core_task.OperationTask(api_task)
+else:
+operation_task = core_task.OperationTask(api_task, 
executor=executor)
 _add_task_and_dependencies(execution_graph, operation_task, 
operation_dependencies)
+
 elif isinstance(api_task, api.task.WorkflowTask):
 # Build the graph recursively while adding start and end 
markers
 build_execution_graph(
 task_graph=api_task,
 execution_graph=execution_graph,
+executor=executor,
 start_cls=core_task.StartSubWorkflowTask,
 end_cls=core_task.EndSubWorkflowTask,
 depends_on=operation_dependencies
 )
-elif isinstance(api_task, api.task.StubTask):
--- End diff --

undelete


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114536083
  
--- Diff: aria/orchestrator/workflows/core/engine.py ---
@@ -109,12 +110,11 @@ def _tasks_iter(self):
 
self._workflow_context.model.task.refresh(task.model_task)
 yield task
 
-def _handle_executable_task(self, task):
-if isinstance(task, engine_task.StubTask):
-task.status = models.Task.SUCCESS
-else:
+@staticmethod
+def _handle_executable_task(task):
+if not isinstance(task, engine_task.StubTask):
--- End diff --

move the event raising into the executor


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114544013
  
--- Diff: aria/orchestrator/workflows/events_logging.py ---
@@ -34,19 +34,25 @@ def _get_task_name(task):
 
 
 @events.start_task_signal.connect
-def _start_task_handler(task, **kwargs):
+def _start_task_handler(task, skip_logging=False, **kwargs):
+if skip_logging:
--- End diff --

remove skip_logging, add task.is_empty check


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114536547
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -108,15 +119,18 @@ class OperationTask(BaseTask):
 """
 Operation task
 """
+def __init__(self, api_task, executor=None, *args, **kwargs):
+# If no executor is provided, we defer that this is a stub task 
which does not need to be
--- End diff --

update comment


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114535773
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -87,86 +88,43 @@ def __init__(self,
if ignore_failure is None else 
ignore_failure)
 self.interface_name = interface_name
 self.operation_name = operation_name
+self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
+ name=actor.name,
+ 
interface=self.interface_name,
+ 
operation=self.operation_name)
+self.is_stub = self.is_empty(self.actor, self.interface_name, 
self.operation_name)
+if self.is_stub:
+return
 
 operation = 
self.actor.interfaces[self.interface_name].operations[self.operation_name]
 self.plugin = operation.plugin
 self.inputs = modeling_utils.create_inputs(inputs or {}, 
operation.inputs)
 self.implementation = operation.implementation
-self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
- name=actor.name,
- 
interface=self.interface_name,
- 
operation=self.operation_name)
 
 def __repr__(self):
 return self.name
 
-@classmethod
-def for_node(cls,
- node,
- interface_name,
- operation_name,
- max_attempts=None,
- retry_interval=None,
- ignore_failure=None,
- inputs=None):
-"""
-Creates an operation on a node.
-
-:param node: The node on which to run the operation
-:param interface_name: The interface name
-:param operation_name: The operation name within the interface
-:param max_attempts: The maximum number of attempts in case the 
operation fails
- (if not specified the defaults it taken from 
the workflow context)
-:param retry_interval: The interval in seconds between attempts 
when the operation fails
-   (if not specified the defaults it taken 
from the workflow context)
-:param ignore_failure: Whether to ignore failures
-   (if not specified the defaults it taken 
from the workflow context)
-:param inputs: Additional operation inputs
-"""
-
-assert isinstance(node, models.Node)
-return cls(
-actor=node,
-interface_name=interface_name,
-operation_name=operation_name,
-max_attempts=max_attempts,
-retry_interval=retry_interval,
-ignore_failure=ignore_failure,
-inputs=inputs)
-
-@classmethod
-def for_relationship(cls,
- relationship,
- interface_name,
- operation_name,
- max_attempts=None,
- retry_interval=None,
- ignore_failure=None,
- inputs=None):
-"""
-Creates an operation on a relationship edge.
-
-:param relationship: The relationship on which to run the operation
-:param interface_name: The interface name
-:param operation_name: The operation name within the interface
-:param max_attempts: The maximum number of attempts in case the 
operation fails
- (if not specified the defaults it taken from 
the workflow context)
-:param retry_interval: The interval in seconds between attempts 
when the operation fails
-   (if not specified the defaults it taken 
from the workflow context)
-:param ignore_failure: Whether to ignore failures
-   (if not specified the defaults it taken 
from the workflow context)
-:param inputs: Additional operation inputs
-"""
-
-assert isinstance(relationship, models.Relationship)
-return cls(
-actor=relationship,
-interface_name=interface_name,
-operation_name=operation_name,
-max_attempts=max_attempts,
-retry_interval=retry_interval,
-ignore_failure=ignore_failure,
-inputs=inputs)
+# def __new__(cls, actor, interface_name, 

[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114537160
  
--- Diff: aria/orchestrator/workflows/core/translation.py ---
@@ -24,6 +24,7 @@
 def build_execution_graph(
 task_graph,
 execution_graph,
+executor,
--- End diff --

default_exec


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114518811
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -61,20 +66,30 @@ def id(self):
 
 class StubTask(BaseTask):
 """
-Base stub task for all tasks that don't actually run anything
+Base stub task for marker user tasks that only mark the start/end of a 
workflow
+or sub-workflow
 """
-
 def __init__(self, *args, **kwargs):
-super(StubTask, self).__init__(*args, **kwargs)
+super(StubTask, self).__init__(executor=dry.MarkerExecutor(), 
*args, **kwargs)
--- End diff --

and rename to stub


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114519196
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -61,20 +66,30 @@ def id(self):
 
 class StubTask(BaseTask):
 """
-Base stub task for all tasks that don't actually run anything
+Base stub task for marker user tasks that only mark the start/end of a 
workflow
+or sub-workflow
 """
-
 def __init__(self, *args, **kwargs):
-super(StubTask, self).__init__(*args, **kwargs)
+super(StubTask, self).__init__(executor=dry.MarkerExecutor(), 
*args, **kwargs)
 self.status = models.Task.PENDING
 self.due_at = datetime.utcnow()
+self.started_at = None
--- End diff --

maybe remove


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114516217
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -199,7 +157,82 @@ def __getattr__(self, item):
 return super(WorkflowTask, self).__getattribute__(item)
 
 
-class StubTask(BaseTask):
+def create_relationships_tasks(
+node, interface_name, source_operation_name=None, 
target_operation_name=None, **kwargs):
+"""
+Creates a relationship task (source and target) for all of a 
node_instance relationships.
+:param basestring source_operation_name: the relationship operation 
name.
+:param basestring interface_name: the name of the interface.
+:param source_operation_name:
+:param target_operation_name:
+:param NodeInstance node: the source_node
+:return:
+"""
+sub_tasks = []
+for relationship in node.outbound_relationships:
+relationship_operations = relationship_tasks(
+relationship,
+interface_name,
+source_operation_name=source_operation_name,
+target_operation_name=target_operation_name,
+**kwargs)
+sub_tasks.append(relationship_operations)
+return sub_tasks
+
+
+def relationship_tasks(relationship, interface_name, 
source_operation_name=None,
+   target_operation_name=None, **kwargs):
+"""
+Creates a relationship task source and target.
+:param Relationship relationship: the relationship instance itself
+:param source_operation_name:
+:param target_operation_name:
+
+:return:
 """
-Enables creating empty tasks.
+operations = []
+if source_operation_name:
+operations.append(
+OperationTask(
+relationship,
+interface_name=interface_name,
+operation_name=source_operation_name,
+**kwargs
+)
+)
+if target_operation_name:
+operations.append(
+OperationTask(
+relationship,
+interface_name=interface_name,
+operation_name=target_operation_name,
+**kwargs
+)
+)
+
+return [op for op in operations if op]
+
+
+def create_node_task_dependencies(graph, tasks_and_nodes, reverse=False):
--- End diff --

move to builtin/workflows.py


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114519107
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -128,17 +146,26 @@ def __init__(self, api_task, *args, **kwargs):
 raise RuntimeError('No operation context could be created for 
{actor.model_cls}'
.format(actor=api_task.actor))
 
+# TODO: this executor should be put into the task (if no executor 
was setup in the
--- End diff --

remove


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114518691
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -61,20 +66,30 @@ def id(self):
 
 class StubTask(BaseTask):
 """
-Base stub task for all tasks that don't actually run anything
+Base stub task for marker user tasks that only mark the start/end of a 
workflow
+or sub-workflow
 """
-
 def __init__(self, *args, **kwargs):
-super(StubTask, self).__init__(*args, **kwargs)
+super(StubTask, self).__init__(executor=dry.MarkerExecutor(), 
*args, **kwargs)
--- End diff --

move MarkerExecutor to a new module


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114515980
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -199,7 +157,82 @@ def __getattr__(self, item):
 return super(WorkflowTask, self).__getattribute__(item)
 
 
-class StubTask(BaseTask):
+def create_relationships_tasks(
+node, interface_name, source_operation_name=None, 
target_operation_name=None, **kwargs):
+"""
+Creates a relationship task (source and target) for all of a 
node_instance relationships.
+:param basestring source_operation_name: the relationship operation 
name.
+:param basestring interface_name: the name of the interface.
+:param source_operation_name:
+:param target_operation_name:
+:param NodeInstance node: the source_node
+:return:
+"""
+sub_tasks = []
+for relationship in node.outbound_relationships:
+relationship_operations = relationship_tasks(
+relationship,
+interface_name,
+source_operation_name=source_operation_name,
+target_operation_name=target_operation_name,
+**kwargs)
+sub_tasks.append(relationship_operations)
+return sub_tasks
+
+
+def relationship_tasks(relationship, interface_name, 
source_operation_name=None,
--- End diff --

create_...


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114515719
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -87,86 +88,43 @@ def __init__(self,
if ignore_failure is None else 
ignore_failure)
 self.interface_name = interface_name
 self.operation_name = operation_name
+self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
+ name=actor.name,
+ 
interface=self.interface_name,
+ 
operation=self.operation_name)
+self.is_stub = self.is_empty(self.actor, self.interface_name, 
self.operation_name)
+if self.is_stub:
+return
 
 operation = 
self.actor.interfaces[self.interface_name].operations[self.operation_name]
 self.plugin = operation.plugin
 self.inputs = modeling_utils.create_inputs(inputs or {}, 
operation.inputs)
 self.implementation = operation.implementation
-self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
- name=actor.name,
- 
interface=self.interface_name,
- 
operation=self.operation_name)
 
 def __repr__(self):
 return self.name
 
-@classmethod
-def for_node(cls,
- node,
- interface_name,
- operation_name,
- max_attempts=None,
- retry_interval=None,
- ignore_failure=None,
- inputs=None):
+def __new__(cls, actor, interface_name, operation_name, *args, 
**kwargs):
 """
-Creates an operation on a node.
-
-:param node: The node on which to run the operation
-:param interface_name: The interface name
-:param operation_name: The operation name within the interface
-:param max_attempts: The maximum number of attempts in case the 
operation fails
- (if not specified the defaults it taken from 
the workflow context)
-:param retry_interval: The interval in seconds between attempts 
when the operation fails
-   (if not specified the defaults it taken 
from the workflow context)
-:param ignore_failure: Whether to ignore failures
-   (if not specified the defaults it taken 
from the workflow context)
-:param inputs: Additional operation inputs
+Returns a new operation task if the operation exists in the node, 
otherwise returns None.
 """
+try:
+cls.is_empty(actor, interface_name, operation_name)
+return super(OperationTask, cls).__new__(cls)
--- End diff --

super(BaseTask, ...)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-03 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114518334
  
--- Diff: aria/orchestrator/workflows/core/events_handler.py ---
@@ -41,6 +41,9 @@ def _task_started(task, *args, **kwargs):
 task.started_at = datetime.utcnow()
 task.status = task.STARTED
 
+@events.start_task_signal.connect
--- End diff --

maybe remove


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #117: ARIA-163 update node state for stub t...

2017-05-01 Thread mxmrlv
GitHub user mxmrlv opened a pull request:

https://github.com/apache/incubator-ariatosca/pull/117

ARIA-163 update node state for stub tasks



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-163-Update-node-state-for-stub-tasks

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/117.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #117


commit 282fcbf9b51e05fe1d1fef2a0835e9c4654dea3f
Author: max-orlov 
Date:   2017-04-30T13:05:27Z

wip

commit 55366e64b69795363e897a6bd185f12ec14990ea
Author: max-orlov 
Date:   2017-04-30T16:54:12Z

wip2

commit cc0ee52e469f05f441c17c24ce9865db1694bed3
Author: max-orlov 
Date:   2017-04-30T19:17:37Z

removed all for_node/rel from the api task

commit e0509d9c4fa8db32e58f093009af74803d28cffd
Author: max-orlov 
Date:   2017-05-01T08:13:51Z

removed utils from builtin workflows. the creation of the Operation Task 
handles some of the utils functions




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---