Example #1
0
    def browse_atoms_for_revert(self, atom=None):
        """Browse next atoms to revert.

        This returns a iterator of atoms that *may* be ready to be be
        reverted, if given a specific atom it will only examine the
        predecessors of that atom, otherwise it will examine the whole
        graph.
        """
        if atom is None:
            atom_it = self.iterate_nodes(co.ATOMS)
        else:
            atom_it = traversal.breadth_first_iterate(
                self._execution_graph,
                atom,
                traversal.Direction.BACKWARD,
                # Stop at the retry boundary (as retries 'control' there
                # surronding atoms, and we don't want to back track over
                # them so that they can correctly affect there associated
                # atoms); we do though need to jump through all tasks since
                # if a predecessor Y was ignored and a predecessor Z before Y
                # was not it should be eligible to now revert...
                through_retries=False)
        for atom in atom_it:
            is_ready, late_decider = self._get_maybe_ready_for_revert(atom)
            if is_ready:
                yield (atom, late_decider)
Example #2
0
    def _browse_atoms_for_execute(self, atom=None):
        """Browse next atoms to execute.

        This returns a iterator of atoms that *may* be ready to be
        executed, if given a specific atom, it will only examine the successors
        of that atom, otherwise it will examine the whole graph.
        """
        if atom is None:
            atom_it = self._runtime.iterate_nodes(co.ATOMS)
        else:
            # NOTE(harlowja): the reason this uses breadth first is so that
            # when deciders are applied that those deciders can be applied
            # from top levels to lower levels since lower levels *may* be
            # able to run even if top levels have deciders that decide to
            # ignore some atoms... (going deeper first would make this
            # problematic to determine as top levels can have their deciders
            # applied **after** going deeper).
            atom_it = traversal.breadth_first_iterate(
                self._execution_graph, atom, traversal.Direction.FORWARD)
        for atom in atom_it:
            is_ready, late_decider = self._get_maybe_ready_for_execute(atom)
            if is_ready:
                yield (atom, late_decider)
Example #3
0
    def browse_atoms_for_execute(self, atom=None):
        """Browse next atoms to execute.

        This returns a iterator of atoms that *may* be ready to be
        executed, if given a specific atom, it will only examine the successors
        of that atom, otherwise it will examine the whole graph.
        """
        if atom is None:
            atom_it = self.iterate_nodes(co.ATOMS)
        else:
            # NOTE(harlowja): the reason this uses breadth first is so that
            # when deciders are applied that those deciders can be applied
            # from top levels to lower levels since lower levels *may* be
            # able to run even if top levels have deciders that decide to
            # ignore some atoms... (going deeper first would make this
            # problematic to determine as top levels can have their deciders
            # applied **after** going deeper).
            atom_it = traversal.breadth_first_iterate(
                self._execution_graph, atom, traversal.Direction.FORWARD)
        for atom in atom_it:
            is_ready, late_decider = self._get_maybe_ready_for_execute(atom)
            if is_ready:
                yield (atom, late_decider)
Example #4
0
    def browse_atoms_for_revert(self, atom=None):
        """Browse next atoms to revert.

        This returns a iterator of atoms that *may* be ready to be be
        reverted, if given a specific atom it will only examine the
        predecessors of that atom, otherwise it will examine the whole
        graph.
        """
        if atom is None:
            atom_it = self.iterate_nodes(co.ATOMS)
        else:
            atom_it = traversal.breadth_first_iterate(
                self._execution_graph, atom, traversal.Direction.BACKWARD,
                # Stop at the retry boundary (as retries 'control' there
                # surronding atoms, and we don't want to back track over
                # them so that they can correctly affect there associated
                # atoms); we do though need to jump through all tasks since
                # if a predecessor Y was ignored and a predecessor Z before Y
                # was not it should be eligible to now revert...
                through_retries=False)
        for atom in atom_it:
            is_ready, late_decider = self._get_maybe_ready_for_revert(atom)
            if is_ready:
                yield (atom, late_decider)