예제 #1
0
파일: api.py 프로젝트: romilly/kolibri
    def cleartasks(self, request):
        """
        Cancels all running tasks.
        """

        queue.empty()
        return Response({})
예제 #2
0
    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)
예제 #3
0
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")
예제 #4
0
파일: server.py 프로젝트: romilly/kolibri
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])
예제 #5
0
def test_importing_queue_no_open_connection():
    from kolibri.core.tasks.main import queue

    queue.empty()