Exemple #1
0
    def resume(self):
        # First, see if there is pending modules remaining
        if self._run_pending_modules():
            return True
        else:
            # If not, look for a path to a waiting module
            for module in self['waiting_modules']:
                try:
                    next_module = dispatcher.next_module(
                        self._types_available(), module, self._tried_modules())
                    self.queue_modules(next_module)
                    return True
                except DispatchingException:
                    self.remove_from('waiting_modules', module)
                    self.append_to('canceled_modules', module)

            # Finally, look for a path to the target
            if self['module'] is not None and self['module'] not in self[
                    'executed_modules']:
                try:
                    next_module = dispatcher.next_module(
                        self._types_available(), self['module'],
                        self._tried_modules())
                    self.queue_modules(next_module)
                    return True
                except DispatchingException:
                    self._error('Could not find execution path to target %s' %
                                self['module'])

        return False
    def resume(self):
        was_resumed = False

        # First, see if there is pending modules remaining
        if self._run_pending_modules():
            was_resumed = True
        # If not and there is no file, look for a preloading module
        elif self._needs_preloading():
            try:
                next_module = dispatcher.next_preloading_module(
                    self['preloading_modules'], self._tried_modules())
                self.queue_modules(next_module)
                was_resumed = True
            except DispatchingException:
                self.log(
                    'warning',
                    'no preloading module was able to find a file for submitted hash'
                )

                for module in list(self['waiting_modules']):
                    self._cancel_module(module)
        # If not, look for a path to a waiting module
        else:
            for module in list(self['waiting_modules']):
                try:
                    next_module = dispatcher.next_module(
                        self._types_available(), module, self._tried_modules())
                    self.queue_modules(next_module)
                    was_resumed = True
                except DispatchingException:
                    self._cancel_module(module)

        if not was_resumed and self['status'] != self.STATUS_ERROR:
            self._mark_as_finished()
Exemple #3
0
    def resume(self):
        was_resumed = False

        # First, see if there is pending modules remaining
        if self._run_pending_modules():
            was_resumed = True
        else:
            # If not, look for a path to a waiting module
            for module in self['waiting_modules']:
                try:
                    next_module = dispatcher.next_module(
                        self._types_available(), module, self._tried_modules())
                    self.queue_modules(next_module)
                    was_resumed = True
                except DispatchingException:
                    self.remove_from('waiting_modules', module)
                    self.append_to('canceled_modules', module)
                    self.log(
                        'warning',
                        'could not find execution path to "{}" (cancelled)'.
                        format(module))

        if not was_resumed and self['status'] != self.STATUS_ERROR:
            self._mark_as_finished()