def _update_task(cls, workbook, task, state, task_output):
        """
        Update the task with the runtime information. The outbound_context
        for this task is also calculated.
        :return: task, outbound_context. task is the updated task and
        computed outbound context.
        """
        workbook_name = task['workbook_name']
        execution_id = task['execution_id']
        task_spec = workbook.tasks.get(task["name"])
        task_runtime_context = task["task_runtime_context"]

        # Compute the outbound_context, state and exec_flow_context.
        outbound_context = data_flow.get_outbound_context(task, task_output)
        state, task_runtime_context = retry.get_task_runtime(
            task_spec, state, outbound_context, task_runtime_context)

        # Update the task.
        update_values = {"state": state,
                         "output": task_output,
                         "task_runtime_context": task_runtime_context}
        task = db_api.task_update(workbook_name, execution_id, task["id"],
                                  update_values)

        return task, outbound_context
Esempio n. 2
0
    def _update_task(cls, workbook, task, state, task_output):
        """
        Update the task with the runtime information. The outbound_context
        for this task is also calculated.
        :return: task, outbound_context. task is the updated task and
        computed outbound context.
        """
        workbook_name = task['workbook_name']
        execution_id = task['execution_id']
        task_spec = workbook.tasks.get(task["name"])
        task_runtime_context = task["task_runtime_context"]

        # Compute the outbound_context, state and exec_flow_context.
        outbound_context = data_flow.get_outbound_context(task, task_output)
        state, task_runtime_context = retry.get_task_runtime(
            task_spec, state, outbound_context, task_runtime_context)

        # Update the task.
        update_values = {
            "state": state,
            "output": task_output,
            "task_runtime_context": task_runtime_context
        }
        task = db_api.task_update(workbook_name, execution_id, task["id"],
                                  update_values)

        return task, outbound_context
    def _create_tasks(cls, task_list, workbook, workbook_name, execution_id):
        tasks = []

        for task in task_list:
            state, task_runtime_context = retry.get_task_runtime(task)
            action_ns = workbook.namespaces.get(task.get_action_namespace())

            action_spec = None
            if action_ns:
                action_spec = \
                    action_ns.actions.get(task.get_action_name())

            db_task = db_api.task_create(workbook_name, execution_id, {
                "name": task.name,
                "requires": task.requires,
                "task_spec": task.to_dict(),
                "action_spec": {} if not action_spec
                else action_spec.to_dict(),
                "state": state,
                "tags": task.get_property("tags", None),
                "task_runtime_context": task_runtime_context
            })

            tasks.append(db_task)

        return tasks
Esempio n. 4
0
    def _create_tasks(cls, task_list, workbook, workbook_name, execution_id):
        tasks = []

        for task in task_list:
            state, task_runtime_context = retry.get_task_runtime(task)
            action_ns = workbook.namespaces.get(task.get_action_namespace())

            action_spec = None
            if action_ns:
                action_spec = \
                    action_ns.actions.get(task.get_action_name())

            db_task = db_api.task_create(
                workbook_name, execution_id, {
                    "name": task.name,
                    "requires": task.requires,
                    "task_spec": task.to_dict(),
                    "action_spec":
                    {} if not action_spec else action_spec.to_dict(),
                    "state": state,
                    "tags": task.get_property("tags", None),
                    "task_runtime_context": task_runtime_context
                })

            tasks.append(db_task)

        return tasks
Esempio n. 5
0
    def _create_tasks(cls, task_list, workbook, workbook_name, execution_id):
        tasks = []

        for task in task_list:
            state, task_runtime_context = retry.get_task_runtime(task)
            action_spec = workbook.get_action(task.get_full_action_name())

            db_task = db_api.task_create(execution_id, {
                "name": task.name,
                "requires": task.get_requires(),
                "task_spec": task.to_dict(),
                "action_spec": {} if not action_spec
                else action_spec.to_dict(),
                "state": state,
                "tags": task.get_property("tags", None),
                "task_runtime_context": task_runtime_context,
                "workbook_name": workbook_name
            })

            tasks.append(db_task)

        return tasks