def start(self): # Initialize the iceqube scheduler to handle scheduled tasks scheduler.clear_scheduler() if not conf.OPTIONS["Deployment"]["DISABLE_PING"]: # schedule the pingback job from kolibri.core.analytics.utils import schedule_ping schedule_ping() # schedule the vacuum job schedule_vacuum() # This is run every time the server is started to clear all the tasks # in the queue queue.empty() # Initialize the iceqube engine to handle queued tasks self.workers = initialize_workers() scheduler.start_scheduler() # Register the Kolibri zeroconf service so it will be discoverable on the network from kolibri.core.discovery.utils.network.search import ( register_zeroconf_service, ) register_zeroconf_service(port=self.port)
def run_services(port): # Initialize the iceqube scheduler to handle scheduled tasks from kolibri.core.tasks.main import scheduler scheduler.clear_scheduler() # schedule the pingback job from kolibri.core.analytics.utils import schedule_ping schedule_ping() # schedule the vacuum job from kolibri.core.deviceadmin.utils import schedule_vacuum schedule_vacuum() # This is run every time the server is started to clear all the tasks # in the queue from kolibri.core.tasks.main import queue queue.empty() # Initialize the iceqube engine to handle queued tasks from kolibri.core.tasks.main import initialize_workers workers = initialize_workers() scheduler.start_scheduler() # Register the Kolibri zeroconf service so it will be discoverable on the network from morango.models import InstanceIDModel from kolibri.core.discovery.utils.network.search import register_zeroconf_service instance, _ = InstanceIDModel.get_or_create_current_instance() register_zeroconf_service(port=port, id=instance.id[:4]) cleanup_func = partial(_cleanup_before_quitting, workers=workers) try: signal.signal(signal.SIGINT, cleanup_func) signal.signal(signal.SIGTERM, cleanup_func) logger.info("Added signal handlers for cleaning up on exit") except ValueError: logger.warn("Error adding signal handlers for cleaning up on exit")
def run_services(port): # Initialize the iceqube scheduler to handle scheduled tasks from kolibri.core.tasks.main import scheduler scheduler.clear_scheduler() # schedule the pingback job from kolibri.core.analytics.utils import schedule_ping schedule_ping() # schedule the vacuum job from kolibri.core.deviceadmin.utils import schedule_vacuum schedule_vacuum() # This is run every time the server is started to clear all the tasks # in the queue from kolibri.core.tasks.main import queue queue.empty() # Initialize the iceqube engine to handle queued tasks from kolibri.core.tasks.main import initialize_worker initialize_worker() scheduler.start_scheduler() atexit.register(scheduler.shutdown_scheduler) # Register the Kolibri zeroconf service so it will be discoverable on the network from morango.models import InstanceIDModel from kolibri.core.discovery.utils.network.search import register_zeroconf_service instance, _ = InstanceIDModel.get_or_create_current_instance() register_zeroconf_service(port=port, id=instance.id[:4])
def START(self): from kolibri.core.tasks.main import initialize_workers from kolibri.core.tasks.main import scheduler from kolibri.core.analytics.utils import DEFAULT_PING_JOB_ID from kolibri.core.deviceadmin.utils import SCH_VACUUM_JOB_ID # schedule the pingback job if not already scheduled if DEFAULT_PING_JOB_ID not in scheduler: from kolibri.core.analytics.utils import schedule_ping schedule_ping() # schedule the vacuum job if not already scheduled if SCH_VACUUM_JOB_ID not in scheduler: from kolibri.core.deviceadmin.utils import schedule_vacuum schedule_vacuum() # Initialize the iceqube engine to handle queued tasks self.workers = initialize_workers() # Initialize the iceqube scheduler to handle scheduled tasks scheduler.start_scheduler()