Пример #1
0
def process_initializer():
    # There seems to a bug in multiprocessing (backport?)
    # when detached, where the worker gets EOFErrors from time to time
    # and the logger is left from the parent process causing a crash.
    platform.reset_signal("SIGTERM")
    _hijack_multiprocessing_logger()
    platform.set_mp_process_title("celeryd")
Пример #2
0
def process_initializer():
    # There seems to a bug in multiprocessing (backport?)
    # when detached, where the worker gets EOFErrors from time to time
    # and the logger is left from the parent process causing a crash.
    _hijack_multiprocessing_logger()

    platform.reset_signal("SIGTERM")
    platform.set_mp_process_title("celeryd")

    # This is for windows and other platforms not supporting
    # fork(). Note that init_worker makes sure it's only
    # run once per process.
    from celery.loaders import current_loader
    current_loader().init_worker()
Пример #3
0
def process_initializer():
    """Initializes the process so it can be used to process tasks.

    Used for multiprocessing environments.

    """
    # There seems to a bug in multiprocessing (backport?)
    # when detached, where the worker gets EOFErrors from time to time
    # and the logger is left from the parent process causing a crash.
    _hijack_multiprocessing_logger()

    platform.reset_signal("SIGTERM")
    platform.ignore_signal("SIGINT")
    platform.set_mp_process_title("celeryd")

    # This is for windows and other platforms not supporting
    # fork(). Note that init_worker makes sure it's only
    # run once per process.
    from celery.loaders import current_loader
    current_loader().init_worker()

    signals.worker_process_init.send(sender=None)
Пример #4
0
def process_initializer():
    # There seems to a bug in multiprocessing (backport?)
    # when detached, where the worker gets EOFErrors from time to time
    # and the logger is left from the parent process causing a crash.
    _hijack_multiprocessing_logger()

    platform.reset_signal("SIGTERM")
    platform.set_mp_process_title("celeryd")

    # On Windows we need to run a dummy command 'celeryinit'
    # for django to fully initialize after fork()
    if not callable(getattr(os, "fork", None)):
        from django.core.management import execute_manager

        settings_mod = os.environ.get("DJANGO_SETTINGS_MODULE", "settings")
        project_settings = __import__(settings_mod, {}, {}, [""])
        execute_manager(project_settings, argv=["manage.py", "celeryinit"])

    # This is for windows and other platforms not supporting
    # fork(). Note that init_worker makes sure it's only
    # run once per process.
    from celery.loaders import current_loader

    current_loader().init_worker()
Пример #5
0
 def run(self):
     platform.reset_signal("SIGTERM")
     self.clockservice.start(embedded_process=True)