예제 #1
0
    def start(self):
        """Starts the workers main loop."""
        self.on_start()
        self._state = self.RUN
        if self.pidfile:
            self.pidlock = platforms.create_pidlock(self.pidfile)
        try:
            for i, component in enumerate(self.components):
                logger.debug('Starting %s...', qualname(component))
                self._running = i + 1
                if component:
                    component.start()
                logger.debug('%s OK!', qualname(component))
        except SystemTerminate:
            self.terminate()
        except Exception as exc:
            logger.error('Unrecoverable error: %r', exc,
                         exc_info=True)
            self.stop()
        except (KeyboardInterrupt, SystemExit):
            self.stop()

        try:
            # Will only get here if running green,
            # makes sure all greenthreads have exited.
            self._shutdown_complete.wait()
        except IGNORE_ERRORS:
            pass
예제 #2
0
파일: __init__.py 프로젝트: kanzure/celery
    def start(self):
        """Starts the workers main loop."""
        self.on_start()
        self._state = self.RUN
        if self.pidfile:
            self.pidlock = platforms.create_pidlock(self.pidfile)
        try:
            for i, component in enumerate(self.components):
                logger.debug('Starting %s...', qualname(component))
                self._running = i + 1
                if component:
                    component.start()
                logger.debug('%s OK!', qualname(component))
        except SystemTerminate:
            self.terminate()
        except Exception as exc:
            logger.error('Unrecoverable error: %r', exc, exc_info=True)
            self.stop()
        except (KeyboardInterrupt, SystemExit):
            self.stop()

        try:
            # Will only get here if running green,
            # makes sure all greenthreads have exited.
            self._shutdown_complete.wait()
        except IGNORE_ERRORS:
            pass
예제 #3
0
 def start(self):
     """Starts the workers main loop."""
     try:
         self.blueprint.start(self)
     except WorkerTerminate:
         self.terminate()
     except Exception as exc:
         logger.error('Unrecoverable error: %r', exc, exc_info=True)
         self.stop()
     except (KeyboardInterrupt, SystemExit):
         self.stop()
예제 #4
0
 def start(self):
     """Starts the workers main loop."""
     try:
         self.blueprint.start(self)
     except SystemTerminate:
         self.terminate()
     except Exception as exc:
         logger.error('Unrecoverable error: %r', exc, exc_info=True)
         self.stop()
     except (KeyboardInterrupt, SystemExit):
         self.stop()
예제 #5
0
 def start(self):
     """Starts the workers main loop."""
     try:
         self.namespace.start(self)
     except SystemTerminate:
         self.terminate()
     except Exception as exc:
         logger.error("Unrecoverable error: %r", exc, exc_info=True)
         self.stop()
     except (KeyboardInterrupt, SystemExit):
         self.stop()
예제 #6
0
 def start(self):
     """Starts the workers main loop."""
     try:
         self.blueprint.start(self)
     except WorkerTerminate:
         self.terminate()
     except Exception as exc:
         logger.error('Unrecoverable error: %r', exc, exc_info=True)
         self.stop(exitcode=EX_FAILURE)
     except SystemExit as exc:
         self.stop(exitcode=exc.code)
     except KeyboardInterrupt:
         self.stop(exitcode=EX_FAILURE)
예제 #7
0
 def on_timer_error(self, exc):
     logger.error('Timer error: %r', exc, exc_info=True)
예제 #8
0
 def on_timer_error(self, exc):
     logger.error('Timer error: %r', exc, exc_info=True)