Exemplo n.º 1
0
    def _do_step(self, wait_on=None):
        if self._aborted:
            return

        if self._intersteps:
            for i in self._intersteps:
                i.on_next_step_starting(self)
            self._intersteps = ()
        self._barriers = []

        try:
            finished, retval = self._stepper.step()
        except _PropagateReturn:
            finished, retval = True, None

        # Could have aborted during the step
        if self._aborted:
            return

        if not finished:
            if retval is not None:
                if isinstance(retval, tuple):
                    self._intersteps = retval
                elif isinstance(retval, Interstep):
                    self._intersteps = (retval,)
                else:
                    raise TypeError(
                        "Invalid value returned from step '{}'".format(retval))
                for i in self._intersteps:
                    i.on_last_step_finished(self)

            if self._barriers:
                return WaitOnAll(self._do_step.__name__, self._barriers)
            else:
                return Checkpoint(self._do_step.__name__)
Exemplo n.º 2
0
 def _do_step(self, wait_on=None):
     finished, retval = self._stepper.step()
     if not finished:
         if isinstance(retval, ResultToContext):
             return _ResultToContext(self._do_step.__name__,
                                     **retval.to_assign)
         else:
             return Checkpoint(self._do_step.__name__)
Exemplo n.º 3
0
    def _do_step(self, wait_on=None):
        if self._intersteps:
            for i in self._intersteps:
                i.on_next_step_starting(self)
            self._intersteps = None
        self._barriers = []

        finished, retval = self._stepper.step()
        if not finished:
            if retval is not None:
                if isinstance(retval, tuple):
                    self._intersteps = retval
                elif isinstance(retval, Interstep):
                    self._intersteps = (retval, )
                else:
                    raise TypeError(
                        "Invalid value returned from step '{}'".format(retval))
                for i in self._intersteps:
                    i.on_last_step_finished(self)

            if self._barriers:
                return WaitOnAll(self._do_step.__name__, self._barriers)
            else:
                return Checkpoint(self._do_step.__name__)
Exemplo n.º 4
0
 def _run(self):
     return Checkpoint(), self.finish
Exemplo n.º 5
0
 def middle_step(self, wait_on):
     return Checkpoint(), None
Exemplo n.º 6
0
 def _run(self):
     self.out("test", 5)
     return Checkpoint(), self.middle_step
Exemplo n.º 7
0
 def middle_step(self, wait_on):
     return Checkpoint(), self.finish