Github user mxmrlv commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104312966
--- Diff: aria/modeling/orchestration.py ---
@@ -451,12 +451,45 @@ def actor(self):
"""
return self.node or self.relationship
+ @orm.validates('max_attempts')
+ def validate_max_attempts(self, _, value):
# pylint: disable=no-self-use
+ """Validates that max attempts is either -1 or a positive number"""
+ if value < 1 and value != TaskBase.INFINITE_RETRIES:
+ raise ValueError('Max attempts can be either -1 (infinite) or
any positive number. '
+ 'Got {value}'.format(value=value))
+ return value
+
+ # region foreign keys
+
+ __private_fields__ = ['node_fk',
+ 'relationship_fk',
+ 'plugin_fk',
+ 'execution_fk']
+
+ @declared_attr
+ def node_fk(cls):
+ return cls.foreign_key('node', nullable=True)
+
+ @declared_attr
+ def relationship_fk(cls):
+ return cls.foreign_key('relationship', nullable=True)
+
+ @declared_attr
+ def plugin_fk(cls):
+ return cls.foreign_key('plugin', nullable=True)
+
+ @declared_attr
+ def execution_fk(cls):
+ return cls.foreign_key('execution', nullable=True)
+
+ # endregion
+
@classmethod
- def as_node_instance(cls, instance, runs_on, **kwargs):
+ def as_node_task(cls, instance, runs_on, **kwargs):
return cls(node=instance, _runs_on=runs_on, **kwargs)
@classmethod
- def as_relationship_instance(cls, instance, runs_on, **kwargs):
+ def as_relationship_task(cls, instance, runs_on, **kwargs):
--- End diff --
ditto
---
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.
---