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()
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
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()
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
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()
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)
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)
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)
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)
def test_compat(self): self.assertEqual(syn.blocking(lambda: 10), 10) syn.select_blocking_method('foo')
def test_compat(self): assert syn.blocking(lambda: 10) == 10 syn.select_blocking_method('foo')