Esempio n. 1
0
 def init_restart_handler(self):
     restartmon = confservice.get('server', 'restartmon')
     if restartmon:
         LOGGER.info(f"Reload handler monitoring: {restartmon}")
         check_time = confservice.getint('server', 'restartmon_check_time',
                                         3000)
         self._reload_handler = watchfiles(
             [restartmon], lambda *_args: self.reload_qgis_processes(),
             check_time)
         self._reload_handler.start()
    def __init__(self, processes=[]):
        self.processes = {}
        self._context_processes = lrucache(50)

        maxqueuesize = confservice.getint('server','maxqueuesize')

        self._pool = create_client( maxqueuesize )
        self._factory = get_process_factory()

        self.install_processes( processes )

        # Launch the cleanup task
        self.schedule_cleanup()
Esempio n. 3
0
    def __init__(self, processes: Iterable[WPSProcess]):

        maxqueuesize = confservice.getint('server', 'maxqueuesize')

        self._pool = create_client(maxqueuesize)
        self._context_processes = lrucache(50)
        self._factory = get_process_factory()
        self._reload_handler = None

        self.processes = {p.identifier: p for p in processes}

        # Launch the cleanup task
        self.schedule_cleanup()

        # Initialize restart handler
        self.init_restart_handler()
Esempio n. 4
0
    def schedule_cleanup(self) -> None:
        """ Schedule a periodic cleanup
        """
        interval = confservice.getint('server', 'cleanup_interval')

        async def _run_cleanup():
            while True:
                await asyncio.sleep(interval)
                try:
                    self._clean_processes()
                except Exception as e:
                    traceback.print_exc()
                    LOGGER.error("Cleanup task failed: %s", e)

        # Schedule the task
        self._cleanup_task = asyncio.ensure_future(_run_cleanup())