Example #1
0
    def _update_inbound_context(self):
        assert self.task_ex

        wf_ctrl = wf_base.get_controller(self.wf_ex, self.wf_spec)

        self.ctx = wf_ctrl.get_task_inbound_context(self.task_spec)
        utils.update_dict(self.task_ex.in_context, self.ctx)
Example #2
0
    def _update_inbound_context(self):
        assert self.task_ex

        wf_ctrl = wf_base.get_controller(self.wf_ex, self.wf_spec)

        self.ctx = wf_ctrl.get_task_inbound_context(self.task_spec)
        utils.update_dict(self.task_ex.in_context, self.ctx)
Example #3
0
    def _update_inbound_context(self):
        task_ex = self.task_ex
        assert task_ex

        wf_ctrl = wf_base.get_controller(self.wf_ex, self.wf_spec)

        self.ctx = wf_ctrl.get_task_inbound_context(self.task_spec)
        data_flow.add_current_task_to_context(self.ctx, task_ex.id,
                                              task_ex.name)

        utils.update_dict(task_ex.in_context, self.ctx)
Example #4
0
def evaluate_task_outbound_context(task_ex):
    """Evaluates task outbound Data Flow context.

    This method assumes that complete task output (after publisher etc.)
    has already been evaluated.
    :param task_ex: DB task.
    :return: Outbound task Data Flow context.
    """
    in_context = (copy.deepcopy(dict(task_ex.in_context))
                  if task_ex.in_context is not None else {})

    return utils.update_dict(in_context, task_ex.published)
Example #5
0
def evaluate_task_outbound_context(task_ex):
    """Evaluates task outbound Data Flow context.

    This method assumes that complete task output (after publisher etc.)
    has already been evaluated.
    :param task_ex: DB task.
    :return: Outbound task Data Flow context.
    """
    # NOTE(rakhmerov): 'task_ex.in_context' has the SQLAlchemy specific
    # type MutableDict. So we need to create a shallow copy using dict(...)
    # initializer and use it. It's enough to be safe in order to manipulate
    # with entries of the result dictionary, like adding more entries.
    # However, we must not change values themselves because they are
    # shared between the original dictionary and the newly created.
    # It's better to avoid using the method copy.deepcopy() because on
    # dictionaries with many entries it significantly increases memory
    # footprint and reduces performance.
    in_context = (dict(task_ex.in_context)
                  if getattr(task_ex, 'in_context', None) is not None else {})

    return utils.update_dict(in_context, getattr(task_ex, 'published', {}))
Example #6
0
def evaluate_task_outbound_context(task_ex):
    """Evaluates task outbound Data Flow context.

    This method assumes that complete task output (after publisher etc.)
    has already been evaluated.
    :param task_ex: DB task.
    :return: Outbound task Data Flow context.
    """
    # NOTE(rakhmerov): 'task_ex.in_context' has the SQLAlchemy specific
    # type MutableDict. So we need to create a shallow copy using dict(...)
    # initializer and use it. It's enough to be safe in order to manipulate
    # with entries of the result dictionary, like adding more entries.
    # However, we must not change values themselves because they are
    # shared between the original dictionary and the newly created.
    # It's better to avoid using the method copy.deepcopy() because on
    # dictionaries with many entries it significantly increases memory
    # footprint and reduces performance.
    in_context = (
        dict(task_ex.in_context)
        if getattr(task_ex, 'in_context', None) is not None else {}
    )

    return utils.update_dict(in_context, getattr(task_ex, 'published', {}))