Пример #1
0
    def run(self,
            loglevel='ERROR',
            logfile=None,
            http_port=8989,
            http_address='',
            app=None,
            detach=False,
            pidfile=None,
            uid=None,
            gid=None,
            umask=None,
            working_directory=None,
            **kwargs):
        print('celerymon %s is starting.' % self.version)
        app = self.app
        workdir = working_directory

        # Setup logging
        if not isinstance(loglevel, int):
            loglevel = LOG_LEVELS[loglevel.upper()]

        # Dump configuration to screen so we have some basic information
        # when users sends e-mails.
        print(
            STARTUP_INFO_FMT % {
                'http_port': http_port,
                'http_address': http_address or 'localhost',
                'conninfo': app.broker_connection().as_uri(),
            })

        print('celerymon has started.')
        set_process_title('celerymon', info=strargv(sys.argv))

        def _run_monitor():
            create_pidlock(pidfile)
            app.log.setup_logging_subsystem(loglevel=loglevel, logfile=logfile)
            logger = app.log.get_default_logger(name='celery.mon')
            monitor = MonitorService(logger=logger,
                                     http_port=http_port,
                                     http_address=http_address)

            try:
                monitor.start()
            except Exception, exc:
                logger.error('celerymon raised exception %r',
                             exc,
                             exc_info=True)
            except KeyboardInterrupt:
                pass
Пример #2
0
    def run(
        self,
        loglevel="ERROR",
        logfile=None,
        http_port=8989,
        http_address="",
        app=None,
        detach=False,
        pidfile=None,
        uid=None,
        gid=None,
        umask=None,
        working_directory=None,
        **kwargs
    ):
        print("celerymon %s is starting." % (self.version,))
        app = self.app
        workdir = working_directory

        # Setup logging
        if not isinstance(loglevel, int):
            loglevel = LOG_LEVELS[loglevel.upper()]

        # Dump configuration to screen so we have some basic information
        # when users sends e-mails.
        print(
            STARTUP_INFO_FMT
            % {
                "http_port": http_port,
                "http_address": http_address or "localhost",
                "conninfo": app.broker_connection().as_uri(),
            }
        )

        print("celerymon has started.")
        set_process_title("celerymon", info=strargv(sys.argv))

        def _run_monitor():
            app.log.setup_logging_subsystem(loglevel=loglevel, logfile=logfile)
            logger = app.log.get_default_logger(name="celery.mon")
            monitor = MonitorService(logger=logger, http_port=http_port, http_address=http_address)

            try:
                monitor.start()
            except Exception, exc:
                logger.error("celerymon raised exception %r\n%s" % (exc, traceback.format_exc()))
            except KeyboardInterrupt:
                pass
    def run(self, app=None, detach=False, pidfile=None,
            uid=None, gid=None, umask=None, working_directory=None, **kwargs):
        print('celery_stalker is starting.')
        app = self.app
        workdir = working_directory

        print(STARTUP_INFO_FMT % {
                'conninfo': app.broker_connection().as_uri(),
        })

        print('celery_stalker has started.')
        set_process_title('celery_stalker', info=strargv(sys.argv))
    
        logfile = 'celery_stalker.log'

        def _run_monitor():
            create_pidlock(pidfile)
            
            logger = logging.getLogger('celery_stalker')
        
            log_handler = logging.FileHandler(logfile)
            
            formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
            
            log_handler.setFormatter(formatter)
            
            logger.addHandler(log_handler)
            
            logger.setLevel(logging.INFO)
            
            monitor = MonitorService(logger=logger)

            try:
                monitor.start()
            except Exception, exc:
                logger.error('celery_stalker raised exception %r',
                             exc, exc_info=True)
            except KeyboardInterrupt:
                pass
Пример #4
0
    def run(self, loglevel='ERROR', logfile=None, http_port=8989,
            http_address='', app=None, detach=False, pidfile=None,
            uid=None, gid=None, umask=None, working_directory=None, **kwargs):
        print('celerymon %s is starting.' % self.version)
        app = self.app
        workdir = working_directory

        # Setup logging
        if not isinstance(loglevel, int):
            loglevel = LOG_LEVELS[loglevel.upper()]

        # Dump configuration to screen so we have some basic information
        # when users sends e-mails.
        print(STARTUP_INFO_FMT % {
                'http_port': http_port,
                'http_address': http_address or 'localhost',
                'conninfo': app.broker_connection().as_uri(),
        })

        print('celerymon has started.')
        set_process_title('celerymon', info=strargv(sys.argv))

        def _run_monitor():
            create_pidlock(pidfile)
            app.log.setup_logging_subsystem(loglevel=loglevel,
                                            logfile=logfile)
            logger = app.log.get_default_logger(name='celery.mon')
            monitor = MonitorService(logger=logger,
                                     http_port=http_port,
                                     http_address=http_address)

            try:
                monitor.start()
            except Exception, exc:
                logger.error('celerymon raised exception %r',
                             exc, exc_info=True)
            except KeyboardInterrupt:
                pass
Пример #5
0
    def run(self, loglevel="ERROR", logfile=None, http_port=8989,
            http_address='', app=None, detach=False, pidfile=None,
            uid=None, gid=None, umask=None, working_directory=None, **kwargs):
        print("celerymon %s is starting." % (self.version, ))
        app = self.app
        workdir = working_directory

        # Setup logging
        if not isinstance(loglevel, int):
            loglevel = LOG_LEVELS[loglevel.upper()]

        # Dump configuration to screen so we have some basic information
        # when users sends e-mails.
        print(STARTUP_INFO_FMT % {
                "http_port": http_port,
                "http_address": http_address or "localhost",
                "conninfo": app.broker_connection().as_uri(),
        })

        print("celerymon has started.")
        set_process_title("celerymon", info=strargv(sys.argv))

        def _run_monitor():
            app.log.setup_logging_subsystem(loglevel=loglevel,
                                            logfile=logfile)
            logger = app.log.get_default_logger(name="celery.mon")
            monitor = MonitorService(logger=logger,
                                     http_port=http_port,
                                     http_address=http_address)

            try:
                monitor.start()
            except Exception, exc:
                logger.error("celerymon raised exception %r\n%s" % (
                                exc, traceback.format_exc()))
            except KeyboardInterrupt:
                pass
Пример #6
0
    def run(self, loglevel="ERROR", logfile=None, http_port=12201,
            http_address='', app=None, detach=False, pidfile=None,
            uid=None, gid=None, umask=None, working_directory=None,
            plugins=None, storage=None, debug=False, **kwargs):
        print("{0} {1} is starting.".format(self.namespace, self.version, ))
        app = self.app
        workdir = working_directory

        # Setup logging
        if not isinstance(loglevel, int):
            loglevel = LOG_LEVELS[loglevel.upper()]

        print("")
        print("Using below's plugins.")
        pprint(plugins)

        # debug server
#        print(STARTUP_INFO_FMT % {
#            "http_port": http_port,
#            "http_address": http_address or "localhost",
#            "conninfo": app.broker_connection().as_uri(),
#        })

        print("")
        print("{0} has started.".format(self.namespace))
        set_process_title("{0}".format(self.namespace), info=strargv(sys.argv))

        if detach:
            with detached(logfile, pidfile, uid, gid, umask, workdir):
                self._run_tracker(
                    loglevel, logfile, http_port,
                    http_address, plugins=plugins, storage=storage)
        else:
            self._run_tracker(
                loglevel, logfile, http_port,
                http_address, plugins=plugins, storage=storage)
Пример #7
0
 def set_process_status(self, info):
     return platforms.set_mp_process_title('celeryd',
             info='%s (%s)' % (info, platforms.strargv(sys.argv)),
             hostname=self.hostname)
Пример #8
0
 def set_process_status(self, info):
     return platforms.set_mp_process_title(
         'celeryd',
         info='{0} ({1})'.format(info, platforms.strargv(sys.argv)),
         hostname=self.hostname,
     )
Пример #9
0
 def set_process_status(self, prog, info=''):
     prog = '{0}:{1}'.format(self.prog_name, prog)
     info = '{0} {1}'.format(info, strargv(sys.argv))
     return set_process_title(prog, info=info)
Пример #10
0
 def set_process_status(self, prog, info=''):
     prog = '%s:%s' % (self.prog_name, prog)
     info = '%s %s' % (info, strargv(sys.argv))
     return set_process_title(prog, info=info)
Пример #11
0
 def set_process_status(self, prog, info=''):
     prog = f'{self.prog_name}:{prog}'
     info = '{} {}'.format(info, strargv(sys.argv))
     return set_process_title(prog, info=info)
Пример #12
0
 def set_process_status(self, info):
     info = "%s (%s)" % (info, platforms.strargv(sys.argv))
     return platforms.set_mp_process_title("celeryd",
                                           info=info,
                                           hostname=self.hostname)
Пример #13
0
def set_process_status(prog, info=""):
    info = "%s %s" % (info, platforms.strargv(sys.argv))
    return platforms.set_process_title(prog, info=info)
Пример #14
0
 def set_process_status(self, info):
     info = "%s (%s)" % (info, platforms.strargv(sys.argv))
     return platforms.set_mp_process_title("celeryd",
                                           info=info,
                                           hostname=self.hostname)
Пример #15
0
 def set_process_status(self, prog, info=""):
     prog = "%s:%s" % (self.prog_name, prog)
     info = "%s %s" % (info, platforms.strargv(sys.argv))
     return platforms.set_process_title(prog, info=info)
Пример #16
0
 def set_process_status(self, info):
     return platforms.set_mp_process_title(
         'celeryd',
         info='%s (%s)' % (info, platforms.strargv(sys.argv)),
         hostname=self.hostname)
Пример #17
0
def _set_process_status(prog, info=''):
    prog = '{0}:{1}'.format('celery events', prog)
    info = '{0} {1}'.format(info, strargv(sys.argv))
    return set_process_title(prog, info=info)
Пример #18
0
def set_process_status(prog, info=""):
        info = "%s %s" % (info, platforms.strargv(sys.argv))
        return platforms.set_process_title(prog,
                                           info=info)
Пример #19
0
 def set_process_status(self, prog, info=''):
     prog = '%s:%s' % (self.prog_name, prog)
     info = '%s %s' % (info, strargv(sys.argv))
     return set_process_title(prog, info=info)