Example #1
0
def _cleanup_before_quitting(signum, frame, workers=None):
    # the IO stack is not thread safe:
    # make sure not to do any logging in here!
    from kolibri.core.discovery.utils.network.search import unregister_zeroconf_service
    from kolibri.core.tasks.main import scheduler

    if workers is not None:
        for worker in workers:
            worker.shutdown()
    scheduler.shutdown_scheduler()
    unregister_zeroconf_service()
    signal.signal(signum, signal.SIG_DFL)
    os.kill(os.getpid(), signum)
Example #2
0
    def STOP(self):
        from kolibri.core.discovery.utils.network.search import (
            unregister_zeroconf_service,
        )

        unregister_zeroconf_service()
        from kolibri.core.tasks.main import scheduler

        scheduler.shutdown_scheduler()

        if self.workers is not None:
            for worker in self.workers:
                worker.shutdown(wait=True)
Example #3
0
def _cleanup_before_quitting(signum, frame):
    from kolibri.core.discovery.utils.network.search import unregister_zeroconf_service

    unregister_zeroconf_service()
    signal.signal(signum, signal.SIG_DFL)
    os.kill(os.getpid(), signum)