How to use the freezer.scheduler.daemon.NoDaemon function in freezer

To help you get started, we’ve selected a few freezer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / freezer / tests / unit / scheduler / test_scheduler_daemon.py View on Github external
def test_exit_handler(self, mock_logging):
        daemon.NoDaemon.exit_flag = False
        self.daemon.handle_program_exit(33, None)
        self.assertEquals(daemon.NoDaemon.exit_flag, True)
        self.assertTrue(self.daemonizable.stop.called)
github openstack / freezer / tests / unit / scheduler / test_scheduler_daemon.py View on Github external
def setUp(self, mock_signal):
        self.daemonizable = Mock()
        self.daemon = daemon.NoDaemon(daemonizable=self.daemonizable)
github openstack / freezer / tests / unit / scheduler / test_scheduler_daemon.py View on Github external
def test_create(self):
        self.assertIsInstance(self.daemon, daemon.NoDaemon)
github openstack / freezer / freezer / scheduler / daemon.py View on Github external
def handle_program_exit(signum, frame):
        LOG.info('Got signal {0}. Exiting ...'.format(signum))
        NoDaemon.exit_flag = True
        NoDaemon.instance.daemonizable.stop()
github openstack / freezer / freezer / scheduler / freezer_scheduler.py View on Github external
print("--no-api mode is not available on windows")
            return 69  # os.EX_UNAVAILABLE

    freezer_utils.create_dir(CONF.jobs_dir, do_log=False)
    freezer_scheduler = FreezerScheduler(apiclient=apiclient,
                                         interval=int(CONF.interval),
                                         job_path=CONF.jobs_dir,
                                         concurrent_jobs=CONF.concurrent_jobs)

    if CONF.no_daemon:
        print('Freezer Scheduler running in no-daemon mode')
        LOG.debug('Freezer Scheduler running in no-daemon mode')
        if winutils.is_windows():
            daemon = win_daemon.NoDaemon(daemonizable=freezer_scheduler)
        else:
            daemon = linux_daemon.NoDaemon(daemonizable=freezer_scheduler)
    else:
        if winutils.is_windows():
            daemon = win_daemon.Daemon(daemonizable=freezer_scheduler,
                                       interval=int(CONF.interval),
                                       job_path=CONF.jobs_dir,
                                       insecure=CONF.insecure,
                                       concurrent_jobs=CONF.concurrent_jobs)
        else:
            daemon = linux_daemon.Daemon(daemonizable=freezer_scheduler)

    if CONF.action == 'start':
        daemon.start()
    elif CONF.action == 'stop':
        daemon.stop()
    elif CONF.action == 'restart':
        daemon.restart()
github openstack / freezer / freezer / scheduler / daemon.py View on Github external
def signal_map(self):
        return {
            signal.SIGTERM: NoDaemon.handle_program_exit,
            signal.SIGINT: NoDaemon.handle_program_exit,
            signal.SIGHUP: NoDaemon.handle_reload,
        }
github openstack / freezer / freezer / scheduler / daemon.py View on Github external
def handle_reload(signum, frame):
        NoDaemon.instance.daemonizable.reload()