Esempio n. 1
0
 def exec_step(msg):
     """
     Execute a workflow step
     :param msg: Workflow step parameters
     :return:
     """
     step_start(step_name, msg["header"])  # Explicit start of new step
     # Clear any summary from the previous step
     msg['summary'] = {}
     result = self._workflow[step_name].get("function",
                                            lambda _: None)(msg)
     if result == END_OF_WORKFLOW:
         self.end_of_workflow(msg)
Esempio n. 2
0
 def exec_step(msg):
     """
     Execute a workflow step
     :param msg: Workflow step parameters
     :return:
     """
     msg['header'] = msg.get('header', {})  # init header if not present
     msg['header'].update(step.header_parameters)
     step_start(step.name, msg["header"])  # Explicit start of new step
     # Clear any summary from the previous step
     msg['summary'] = {}
     result = step.function(msg)
     if result == END_OF_WORKFLOW:
         self.end_of_workflow(msg)
Esempio n. 3
0
 def test_step_start(self, step_save):
     step_save.return_value = Step("any id")
     step = step_start("any step", {})
     self.assertEqual(step["name"], "any step")
     self.assertIsNone(step["start"])
     self.assertIsNone(step["end"])
     self.assertEqual(step["status"], "scheduled")
Esempio n. 4
0
    def reject(self, msg, job):
        """
        Reject a message because the job is already active within GOB

        :param msg:
        :param job:
        :return:
        """
        # Start a workflow step to reject the message
        msg["header"]["process_id"] = job['id']
        msg["header"]["entity"] = msg["header"].get('collection')
        step = step_start("accept", msg['header'])
        step_status(job['id'], step['id'], STATUS_START)
        # End the workflow step and then the workflow job
        step_status(job['id'], step['id'], STATUS_REJECTED)
        return job_end(job['id'], STATUS_REJECTED)