示例#1
0
 def run_evcam(self,
               camera,
               logfile=None,
               pidfile=None,
               uid=None,
               gid=None,
               umask=None,
               working_directory=None,
               detach=False,
               **kwargs):
     from celery.events.snapshot import evcam
     self.set_process_status("cam")
     kwargs["app"] = self.app
     if not detach:
         return evcam(camera, logfile=logfile, pidfile=pidfile, **kwargs)
     context, on_stop = create_daemon_context(
         logfile=logfile,
         pidfile=pidfile,
         uid=uid,
         gid=gid,
         umask=umask,
         working_directory=working_directory)
     context.open()
     try:
         return evcam(camera, logfile=logfile, pidfile=pidfile, **kwargs)
     finally:
         on_stop()
示例#2
0
    def run(self,
            detach=False,
            logfile=None,
            pidfile=None,
            uid=None,
            gid=None,
            umask=None,
            working_directory=None,
            **kwargs):
        kwargs.pop("app", None)

        if not detach:
            return self.app.Beat(logfile=logfile, **kwargs).run()

        context, on_stop = create_daemon_context(
            logfile=logfile,
            pidfile=pidfile,
            uid=uid,
            gid=gid,
            umask=umask,
            working_directory=working_directory)
        context.open()
        try:
            self.app.Beat(pidfile=pidfile, logfile=logfile, **kwargs).run()
        finally:
            on_stop()
示例#3
0
 def start(self):
     context, on_stop = create_daemon_context(
                             logfile=self.logfile,
                             pidfile=self.pidfile,
                             uid=self.uid,
                             gid=self.gid,
                             umask=self.umask,
                             working_directory=self.working_directory)
     context.open()
     try:
         os.execv(self.path, [self.path] + self.argv)
     finally:
         on_stop()
示例#4
0
    def run(
        self, detach=False, logfile=None, pidfile=None, uid=None, gid=None, umask=None, working_directory=None, **kwargs
    ):
        kwargs.pop("app", None)

        if not detach:
            return self.app.Beat(logfile=logfile, **kwargs).run()

        context, on_stop = create_daemon_context(
            logfile=logfile, pidfile=pidfile, uid=uid, gid=gid, umask=umask, working_directory=working_directory
        )
        context.open()
        try:
            self.app.Beat(pidfile=pidfile, logfile=logfile, **kwargs).run()
        finally:
            on_stop()
示例#5
0
 def run_evcam(self, camera, logfile=None, pidfile=None, uid=None,
         gid=None, umask=None, working_directory=None,
         detach=False, **kwargs):
     from celery.events.snapshot import evcam
     self.set_process_status("cam")
     kwargs["app"] = self.app
     if not detach:
         return evcam(camera, logfile=logfile, **kwargs)
     context, on_stop = create_daemon_context(
                             logfile=logfile,
                             pidfile=pidfile,
                             uid=uid,
                             gid=gid,
                             umask=umask,
                             working_directory=working_directory)
     context.open()
     try:
         return evcam(camera, logfile=logfile, **kwargs)
     finally:
         on_stop()
示例#6
0
 def start(self):
     context, on_stop = create_daemon_context(
                             logfile=self.logfile,
                             pidfile=self.pidfile,
                             uid=self.uid,
                             gid=self.gid,
                             umask=self.umask,
                             working_directory=self.working_directory)
     context.open()
     try:
         try:
             os.execv(self.path, [self.path] + self.argv)
         except Exception:
             import logging
             from celery.log import setup_logger
             logger = setup_logger(logfile=self.logfile,
                                   loglevel=logging.ERROR)
             logger.critical("Can't exec %r" % (
                 " ".join([self.path] + self.argv), ),
                 exc_info=sys.exc_info())
     finally:
         on_stop()