Esempio n. 1
0
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.reporter.gerrit
        import zuul.reporter.smtp
        import zuul.trigger.gerrit
        import zuul.trigger.timer
        import zuul.webapp
        import zuul.rpclistener

        if (self.config.has_option('gearman_server', 'start') and
            self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')

        self.sched = zuul.scheduler.Scheduler()

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched)
        gerrit = zuul.trigger.gerrit.Gerrit(self.config, self.sched)
        timer = zuul.trigger.timer.Timer(self.config, self.sched)
        webapp = zuul.webapp.WebApp(self.sched)
        rpc = zuul.rpclistener.RPCListener(self.config, self.sched)
        gerrit_reporter = zuul.reporter.gerrit.Reporter(gerrit)
        smtp_reporter = zuul.reporter.smtp.Reporter(
            self.config.get('smtp', 'default_from')
            if self.config.has_option('smtp', 'default_from') else 'zuul',
            self.config.get('smtp', 'default_to')
            if self.config.has_option('smtp', 'default_to') else 'zuul',
            self.config.get('smtp', 'server')
            if self.config.has_option('smtp', 'server') else 'localhost',
            self.config.get('smtp', 'port')
            if self.config.has_option('smtp', 'port') else 25
        )

        self.sched.setLauncher(gearman)
        self.sched.registerTrigger(gerrit)
        self.sched.registerTrigger(timer)
        self.sched.registerReporter(gerrit_reporter)
        self.sched.registerReporter(smtp_reporter)

        self.sched.start()
        self.sched.reconfigure(self.config)
        self.sched.resume()
        webapp.start()
        rpc.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGUSR2, stack_dump_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print "Ctrl + C: asking scheduler to exit nicely...\n"
                self.exit_handler(signal.SIGINT, None)
Esempio n. 2
0
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.merger.client
        import zuul.lib.swift
        import zuul.webapp
        import zuul.rpclistener

        signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
        if (self.config.has_option('gearman_server', 'start') and
            self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')
        self.log = logging.getLogger("zuul.Server")

        self.sched = zuul.scheduler.Scheduler(self.config)
        # TODO(jhesketh): Move swift into a connection?
        self.swift = zuul.lib.swift.Swift(self.config)

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched,
                                                self.swift)
        merger = zuul.merger.client.MergeClient(self.config, self.sched)

        if self.config.has_option('zuul', 'status_expiry'):
            cache_expiry = self.config.getint('zuul', 'status_expiry')
        else:
            cache_expiry = 1
        webapp = zuul.webapp.WebApp(self.sched, cache_expiry=cache_expiry)
        rpc = zuul.rpclistener.RPCListener(self.config, self.sched)

        self.configure_connections()
        self.sched.setLauncher(gearman)
        self.sched.setMerger(merger)

        self.log.info('Starting scheduler')
        self.sched.start()
        self.sched.registerConnections(self.connections)
        self.sched.reconfigure(self.config)
        self.sched.resume()
        self.log.info('Starting Webapp')
        webapp.start()
        self.log.info('Starting RPC')
        rpc.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print("Ctrl + C: asking scheduler to exit nicely...\n")
                self.exit_handler(signal.SIGINT, None)
Esempio n. 3
0
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.merger.client
        import zuul.lib.swift
        import zuul.webapp
        import zuul.rpclistener

        signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
        if (self.config.has_option('gearman_server', 'start')
                and self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')
        self.log = logging.getLogger("zuul.Server")

        self.sched = zuul.scheduler.Scheduler(self.config)
        # TODO(jhesketh): Move swift into a connection?
        self.swift = zuul.lib.swift.Swift(self.config)

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched,
                                                self.swift)
        merger = zuul.merger.client.MergeClient(self.config, self.sched)

        if self.config.has_option('zuul', 'status_expiry'):
            cache_expiry = self.config.getint('zuul', 'status_expiry')
        else:
            cache_expiry = 1
        webapp = zuul.webapp.WebApp(self.sched, cache_expiry=cache_expiry)
        rpc = zuul.rpclistener.RPCListener(self.config, self.sched)

        self.configure_connections()
        self.sched.setLauncher(gearman)
        self.sched.setMerger(merger)

        self.log.info('Starting scheduler')
        self.sched.start()
        self.sched.registerConnections(self.connections)
        self.sched.reconfigure(self.config)
        self.sched.resume()
        self.log.info('Starting Webapp')
        webapp.start()
        self.log.info('Starting RPC')
        rpc.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print("Ctrl + C: asking scheduler to exit nicely...\n")
                self.exit_handler(signal.SIGINT, None)
Esempio n. 4
0
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.trigger.gerrit
        import zuul.trigger.timer
        import zuul.webapp

        if (self.config.has_option('gearman_server', 'start') and
            self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')

        self.sched = zuul.scheduler.Scheduler()

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched)
        gerrit = zuul.trigger.gerrit.Gerrit(self.config, self.sched)
        timer = zuul.trigger.timer.Timer(self.config, self.sched)
        webapp = zuul.webapp.WebApp(self.sched)

        self.sched.setLauncher(gearman)
        self.sched.registerTrigger(gerrit)
        self.sched.registerTrigger(timer)

        self.sched.start()
        self.sched.reconfigure(self.config)
        self.sched.resume()
        webapp.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGUSR2, stack_dump_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print "Ctrl + C: asking scheduler to exit nicely...\n"
                self.exit_handler(signal.SIGINT, None)
Esempio n. 5
0
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.trigger.gerrit
        import zuul.trigger.timer
        import zuul.webapp

        if (self.config.has_option('gearman_server', 'start') and
            self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')

        self.sched = zuul.scheduler.Scheduler()

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched)
        gerrit = zuul.trigger.gerrit.Gerrit(self.config, self.sched)
        timer = zuul.trigger.timer.Timer(self.config, self.sched)
        webapp = zuul.webapp.WebApp(self.sched)

        self.sched.setLauncher(gearman)
        self.sched.registerTrigger(gerrit)
        self.sched.registerTrigger(timer)

        self.sched.start()
        self.sched.reconfigure(self.config)
        self.sched.resume()
        webapp.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print "Ctrl + C: asking scheduler to exit nicely...\n"
                self.exit_handler(signal.SIGINT, None)
Esempio n. 6
0
File: server.py Progetto: sikeh/zuul
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.merger.client
        import zuul.lib.swift
        import zuul.reporter.gerrit
        import zuul.reporter.smtp
        import zuul.trigger.gerrit
        import zuul.trigger.timer
        import zuul.trigger.zuultrigger
        import zuul.webapp
        import zuul.rpclistener

        signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
        if (self.config.has_option('gearman_server', 'start') and
            self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')
        self.log = logging.getLogger("zuul.Server")

        self.sched = zuul.scheduler.Scheduler()
        self.swift = zuul.lib.swift.Swift(self.config)

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched,
                                                self.swift)
        merger = zuul.merger.client.MergeClient(self.config, self.sched)
        gerrit = zuul.trigger.gerrit.Gerrit(self.config, self.sched)
        timer = zuul.trigger.timer.Timer(self.config, self.sched)
        zuultrigger = zuul.trigger.zuultrigger.ZuulTrigger(self.config,
                                                           self.sched)
        if self.config.has_option('zuul', 'status_expiry'):
            cache_expiry = self.config.getint('zuul', 'status_expiry')
        else:
            cache_expiry = 1
        webapp = zuul.webapp.WebApp(self.sched, cache_expiry=cache_expiry)
        rpc = zuul.rpclistener.RPCListener(self.config, self.sched)
        gerrit_reporter = zuul.reporter.gerrit.Reporter(gerrit)
        smtp_reporter = zuul.reporter.smtp.Reporter(
            self.config.get('smtp', 'default_from')
            if self.config.has_option('smtp', 'default_from') else 'zuul',
            self.config.get('smtp', 'default_to')
            if self.config.has_option('smtp', 'default_to') else 'zuul',
            self.config.get('smtp', 'server')
            if self.config.has_option('smtp', 'server') else 'localhost',
            self.config.get('smtp', 'port')
            if self.config.has_option('smtp', 'port') else 25
        )

        self.sched.setLauncher(gearman)
        self.sched.setMerger(merger)
        self.sched.registerTrigger(gerrit)
        self.sched.registerTrigger(timer)
        self.sched.registerTrigger(zuultrigger)
        self.sched.registerReporter(gerrit_reporter)
        self.sched.registerReporter(smtp_reporter)

        self.log.info('Starting scheduler')
        self.sched.start()
        self.sched.reconfigure(self.config)
        self.sched.resume()
        self.log.info('Starting Webapp')
        webapp.start()
        self.log.info('Starting RPC')
        rpc.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print "Ctrl + C: asking scheduler to exit nicely...\n"
                self.exit_handler(signal.SIGINT, None)
Esempio n. 7
0
    def main(self):
        # See comment at top of file about zuul imports
        import zuul.scheduler
        import zuul.launcher.gearman
        import zuul.merger.client
        import zuul.lib.swift
        import zuul.reporter.gerrit
        import zuul.reporter.smtp
        import zuul.trigger.gerrit
        import zuul.trigger.timer
        import zuul.trigger.zuultrigger
        import zuul.webapp
        import zuul.rpclistener

        if (self.config.has_option('gearman_server', 'start')
                and self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        self.setup_logging('zuul', 'log_config')
        self.log = logging.getLogger("zuul.Server")

        self.sched = zuul.scheduler.Scheduler()
        self.swift = zuul.lib.swift.Swift(self.config)

        gearman = zuul.launcher.gearman.Gearman(self.config, self.sched,
                                                self.swift)
        merger = zuul.merger.client.MergeClient(self.config, self.sched)
        gerrit = zuul.trigger.gerrit.Gerrit(self.config, self.sched)
        timer = zuul.trigger.timer.Timer(self.config, self.sched)
        zuultrigger = zuul.trigger.zuultrigger.ZuulTrigger(
            self.config, self.sched)
        if self.config.has_option('zuul', 'status_expiry'):
            cache_expiry = self.config.getint('zuul', 'status_expiry')
        else:
            cache_expiry = 1
        webapp = zuul.webapp.WebApp(self.sched, cache_expiry=cache_expiry)
        rpc = zuul.rpclistener.RPCListener(self.config, self.sched)
        gerrit_reporter = zuul.reporter.gerrit.Reporter(gerrit)
        smtp_reporter = zuul.reporter.smtp.Reporter(
            self.config.get('smtp', 'default_from') if self.config.has_option(
                'smtp', 'default_from') else 'zuul',
            self.config.get('smtp', 'default_to') if self.config.has_option(
                'smtp', 'default_to') else 'zuul',
            self.config.get('smtp', 'server') if self.config.has_option(
                'smtp', 'server') else 'localhost',
            self.config.get('smtp', 'port') if self.config.has_option(
                'smtp', 'port') else 25)

        self.sched.setLauncher(gearman)
        self.sched.setMerger(merger)
        self.sched.registerTrigger(gerrit)
        self.sched.registerTrigger(timer)
        self.sched.registerTrigger(zuultrigger)
        self.sched.registerReporter(gerrit_reporter)
        self.sched.registerReporter(smtp_reporter)

        self.log.info('Starting scheduler')
        self.sched.start()
        self.sched.reconfigure(self.config)
        self.sched.resume()
        self.log.info('Starting Webapp')
        webapp.start()
        self.log.info('Starting RPC')
        rpc.start()

        signal.signal(signal.SIGHUP, self.reconfigure_handler)
        signal.signal(signal.SIGUSR1, self.exit_handler)
        signal.signal(signal.SIGUSR2, zuul.cmd.stack_dump_handler)
        signal.signal(signal.SIGTERM, self.term_handler)
        while True:
            try:
                signal.pause()
            except KeyboardInterrupt:
                print "Ctrl + C: asking scheduler to exit nicely...\n"
                self.exit_handler(signal.SIGINT, None)