Github user mxmrlv commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/168#discussion_r124746941 --- Diff: aria/modeling/orchestration.py --- @@ -72,50 +68,65 @@ class ExecutionBase(mixins.ModelMixin): CANCELLED: PENDING } - @orm.validates('status') - def validate_status(self, key, value): - """Validation function that verifies execution status transitions are OK""" - try: - current_status = getattr(self, key) - except AttributeError: - return - valid_transitions = self.VALID_TRANSITIONS.get(current_status, []) - if all([current_status is not None, - current_status != value, - value not in valid_transitions]): - raise ValueError('Cannot change execution status from {current} to {new}'.format( - current=current_status, - new=value)) - return value + # region one_to_many relationships - created_at = Column(DateTime, index=True) - started_at = Column(DateTime, nullable=True, index=True) - ended_at = Column(DateTime, nullable=True, index=True) - error = Column(Text, nullable=True) - status = Column(Enum(*STATES, name='execution_status'), default=PENDING) - workflow_name = Column(Text) + @declared_attr + def inputs(cls): + """ + Execution parameters. - def has_ended(self): - return self.status in self.END_STATES + :type: {:obj:`basestring`: :class:`Input`} + """ + return relationship.one_to_many(cls, 'input', dict_key='name') - def is_active(self): - return not self.has_ended() and self.status != self.PENDING + @declared_attr + def tasks(cls): + """ + Tasks. + + :type: [:class:`Task`] + """ + return relationship.one_to_many(cls, 'task') @declared_attr def logs(cls): + """ + General log messages for the execution (not for its tasks). --- End diff -- fix
--- 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. ---