Esempio n. 1
0
        def fn_steps_done(steps_done):
            marker = {
                "step": self.step_name,
                "status": "scheduled",
                "forced": False,
                "reasons": []
            }
            chain = Chain()
            if step_will_run(self.step_name, workflow.get_forced_steps(), steps_done, self.force):
                if step_is_forced(self.step_name, workflow.get_forced_steps(), self.force):
                    marker["forced"] = True
                    marker["reasons"] = get_step_force_reasons(self.step_name, workflow.steps_forced_reasons)

                workflow.add_forced_steps(self.force_steps_if_executed, 'Dep of {}'.format(self.step_name))
                chain += (
                    self.activities,
                    (activity.Activity(MarkStepDoneTask, **workflow._get_step_activity_params()),
                     workflow.get_step_bucket(),
                     workflow.get_step_path_prefix(),
                     self.step_name),
                    workflow.record_marker('log.step', marker)
                )
            else:
                marker["status"] = "skipped"
                if self.activities_if_step_already_done:
                    chain.append(self.activities_if_step_already_done)
                chain.append(
                    workflow.record_marker('log.step', marker))

            if self.emit_signal:
                chain.append(
                    workflow.signal('step.{}'.format(self.step_name), propagate=False))
            return chain
Esempio n. 2
0
 def get_steps_done_activity(self):
     return task.ActivityTask(
         activity.Activity(GetStepsDoneTask,
                           **self._get_step_activity_params()),
         self.get_step_bucket(),
         self.get_step_path_prefix(),
     )
Esempio n. 3
0
        def fn_steps_done(steps_done):
            marker = {
                "step": self.step_name,
                "status": "scheduled",
                "forced": False,
                "reasons": [],
            }
            chain = Chain()
            forced_steps = workflow.get_forced_steps()
            skipped_steps = workflow.get_skipped_steps()
            if step_will_run(
                self.step_name, forced_steps, skipped_steps, steps_done, self.force
            ):
                if step_is_forced(self.step_name, forced_steps, self.force):
                    marker["forced"] = True
                    marker["reasons"] = get_step_force_reasons(
                        self.step_name, getattr(workflow, "steps_forced_reasons", {})
                    )

                marker_done = copy.copy(marker)
                marker_done["status"] = "completed"

                workflow.add_forced_steps(
                    self.force_steps_if_executed, "Dep of {}".format(self.step_name)
                )
                chain += (
                    workflow.record_marker("log.step", marker),
                    self.activities,
                    (
                        activity.Activity(
                            MarkStepDoneTask, **workflow._get_step_activity_params()
                        ),
                        workflow.get_step_bucket(),
                        workflow.get_step_path_prefix(),
                        self.step_name,
                    ),
                    workflow.record_marker("log.step", marker_done),
                )
            else:
                marker["status"] = "skipped"
                if step_is_skipped_by_force(self.step_name, skipped_steps):
                    marker["forced"] = True
                    marker["reasons"] = get_step_skip_reasons(
                        self.step_name, getattr(workflow, "steps_skipped_reasons", {})
                    )
                else:
                    marker["reasons"] = ["Step was already played"]

                if self.activities_if_step_already_done:
                    chain.append(self.activities_if_step_already_done)
                chain.append(workflow.record_marker("log.step", marker))

            if self.emit_signal:
                chain.append(
                    workflow.signal("step.{}".format(self.step_name), propagate=False)
                )
            chain.bubbles_exception_on_failure = self.bubbles_exception_on_failure
            return chain