How to use the hupper.reloader function in hupper

To help you get started, we’ve selected a few hupper 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 TurboGears / gearbox / gearbox / commands / serve.py View on Github external
if cmd == 'status' or opts.show_status:
            return self.show_status(opts)

        if opts.monitor_restart and opts.reload:
            self.out('Cannot user --monitor-restart with --reload')
            return 2

        if opts.monitor_restart and not os.environ.get(self._monitor_environ_key):
            # gearbox serve was started with an angel and we are not already inside the angel.
            # Switch this process to being the angel and start a new one with the real server.
            return self.restart_with_monitor()

        if opts.reload and not hupper.is_active():
            if self.verbose > 1:
                self.out('Running reloading file monitor')
            reloader = hupper.reloader.Reloader(
                worker_path='gearbox.main.main',
                reload_interval=opts.reload_interval,
                monitor_factory=hupper.reloader.find_default_monitor_factory(
                    logging.getLogger('gearbox')
                ),
                logger=logging.getLogger('gearbox'),
            )
            reloader.run()

        if hupper.is_active():
            # Tack also config file changes
            hupper.get_reloader().watch_files([opts.config_file])

        if cmd == 'restart' or cmd == 'stop':
            result = self.stop_daemon(opts)
            if result:
github TurboGears / gearbox / gearbox / commands / serve.py View on Github external
if opts.monitor_restart and opts.reload:
            self.out('Cannot user --monitor-restart with --reload')
            return 2

        if opts.monitor_restart and not os.environ.get(self._monitor_environ_key):
            # gearbox serve was started with an angel and we are not already inside the angel.
            # Switch this process to being the angel and start a new one with the real server.
            return self.restart_with_monitor()

        if opts.reload and not hupper.is_active():
            if self.verbose > 1:
                self.out('Running reloading file monitor')
            reloader = hupper.reloader.Reloader(
                worker_path='gearbox.main.main',
                reload_interval=opts.reload_interval,
                monitor_factory=hupper.reloader.find_default_monitor_factory(
                    logging.getLogger('gearbox')
                ),
                logger=logging.getLogger('gearbox'),
            )
            reloader.run()

        if hupper.is_active():
            # Tack also config file changes
            hupper.get_reloader().watch_files([opts.config_file])

        if cmd == 'restart' or cmd == 'stop':
            result = self.stop_daemon(opts)
            if result:
                if cmd == 'restart':
                    self.out("Could not stop daemon; aborting")
                else: