Example #1
0
 def get_decisions_decision_failed(self, events_decision_failed):
     decisions = []
     for event in events_decision_failed:
         last_event_id = self.history.get_event_attributes(event)['startedEventId']
         first_event_id = self.history.get_id_previous_started(event)
         decisions.extend(self._collect_decisions(first_event_id, last_event_id))
     return decisions
Example #2
0
 def get_decisions_decision_failed(self, events_decision_failed):
     decisions = []
     for event in events_decision_failed:
         last_event_id = self.history.get_event_attributes(event)['startedEventId']
         first_event_id = self.history.get_id_previous_started(event)
         builder = floto.decider.DecisionBuilder(activity_tasks=self.activity_tasks,
                 default_activity_task_list = self.default_activity_task_list)
         builder.first_event_id = first_event_id
         builder.last_event_id = last_event_id
         builder._set_history(self.history)
         decisions.extend(builder._collect_decisions())
     return decisions
Example #3
0
    def _collect_decisions(self, first_event_id, last_event_id):
        if first_event_id == 0:
            return self.get_decisions_after_workflow_start()

        decisions = []
        events = self.history.get_events_for_decision(first_event_id, last_event_id)

        if events['faulty']:
            decisions.extend(self.get_decisions_faulty_tasks(events['faulty']))

        if not self.is_terminate_workflow() and events['completed'] and \
                self.all_workflow_tasks_finished(events['completed']):
            decisions = self.get_decisions_after_successfull_workflow_execution()

        if not self.is_terminate_workflow() and events['completed']:
            decisions.extend(self.get_decisions_after_activity_completion(events['completed']))

        if not self.is_terminate_workflow() and events['decision_failed']:
            decisions.extend(self.get_decisions_decision_failed(events['decision_failed']))
        return decisions
Example #4
0
    def _collect_decisions(self):
        logger.debug('DecisionBuilder._collect_decisions({},{})'.format(self.first_event_id, 
            self.last_event_id))

        if self.first_event_id == 0:
            return self.get_decisions_after_workflow_start()

        decisions = []
        events = self.history.get_events_for_decision(self.first_event_id, self.last_event_id)

        if events['faulty']:
            decisions.extend(self.get_decisions_faulty_tasks(events['faulty']))

        if not self.is_terminate_workflow() and events['completed'] and \
                self.all_workflow_tasks_finished(events['completed']):
            decisions = self.get_decisions_after_successful_workflow_execution()

        if not self.is_terminate_workflow() and events['completed']:
            decisions.extend(self.get_decisions_after_activity_completion(events['completed']))

        if not self.is_terminate_workflow() and events['decision_failed']:
            decisions.extend(self.get_decisions_decision_failed(events['decision_failed']))

        return decisions