Пример #1
0
    def start(self):
        """Starts the workers main loop."""
        self._state = self.RUN

        try:
            for i, component in enumerate(self.components):
                self.logger.debug("Starting thread %s...",
                                  component.__class__.__name__)
                self._running = i + 1
                blocking(component.start)
        except SystemTerminate:
            self.terminate()
            raise
        except SystemExit:
            self.stop()
            raise
        except Exception:
            self.stop()
            raise
        except:
            self.stop()
            try:
                raise
            except TypeError:
                # eventlet borks here saying that the exception is None(?)
                sys.exit()
Пример #2
0
    def start(self):
        """Starts the workers main loop."""
        self._state = self.RUN

        try:
            for i, component in enumerate(self.components):
                self.logger.debug("Starting thread %s..." % (component.__class__.__name__))
                self._running = i + 1
                blocking(component.start)
        except SystemTerminate:
            self.terminate()
            raise
        except:
            self.stop()
            raise
Пример #3
0
    def start(self):
        """Starts the workers main loop."""
        self._state = self.RUN

        try:
            for i, component in enumerate(self.components):
                self.logger.debug("Starting thread %s...",
                                  component.__class__.__name__)
                self._running = i + 1
                blocking(component.start)
        except SystemTerminate:
            self.terminate()
        except Exception, exc:
            self.logger.error("Unrecoverable error: %r" % (exc, ),
                              exc_info=sys.exc_info())
            self.stop()
Пример #4
0
    def start(self):
        """Starts the workers main loop."""
        self._state = self.RUN

        try:
            for i, component in enumerate(self.components):
                self.logger.debug("Starting thread %s..." %
                                  (component.__class__.__name__))
                self._running = i + 1
                blocking(component.start)
        except SystemTerminate:
            self.terminate()
            raise SystemExit()
        except (SystemExit, KeyboardInterrupt), exc:
            self.stop()
            raise exc
Пример #5
0
    def start(self):
        """Starts the workers main loop."""
        self._state = self.RUN

        try:
            for i, component in enumerate(self.components):
                self.logger.debug("Starting thread %s...",
                                  component.__class__.__name__)
                self._running = i + 1
                blocking(component.start)
        except SystemTerminate:
            self.terminate()
        except:
            self.stop()

        # Will only get here if running green,
        # makes sure all greenthreads have exited.
        self._shutdown_complete.wait()
Пример #6
0
 def terminate(self, in_sighandler=False):
     """Not so graceful shutdown of the worker server."""
     if not in_sighandler or self.pool.signal_safe:
         blocking(self._shutdown, warm=False)
Пример #7
0
 def stop(self, in_sighandler=False):
     """Graceful shutdown of the worker server."""
     if not in_sighandler or self.pool.signal_safe:
         blocking(self._shutdown, warm=True)
Пример #8
0
 def terminate(self, in_sighandler=False):
     """Not so graceful shutdown of the worker server."""
     if in_sighandler and not self.pool.signal_safe:
         return
     blocking(self._shutdown, warm=False)
Пример #9
0
 def stop(self, in_sighandler=False):
     """Graceful shutdown of the worker server."""
     if in_sighandler and not self.pool.signal_safe:
         return
     blocking(self._shutdown, warm=True)
Пример #10
0
 def test_compat(self):
     self.assertEqual(syn.blocking(lambda: 10), 10)
     syn.select_blocking_method('foo')
Пример #11
0
 def test_compat(self):
     self.assertEqual(syn.blocking(lambda: 10), 10)
     syn.select_blocking_method('foo')
Пример #12
0
 def test_compat(self):
     assert syn.blocking(lambda: 10) == 10
     syn.select_blocking_method('foo')