|
@@ -67,6 +67,7 @@ import sys
|
|
|
import socket
|
|
|
import logging
|
|
|
import optparse
|
|
|
+import platform as _platform
|
|
|
import warnings
|
|
|
import multiprocessing
|
|
|
|
|
@@ -81,6 +82,9 @@ from celery.worker import WorkController
|
|
|
from celery.exceptions import ImproperlyConfigured
|
|
|
from celery.routes import Router
|
|
|
|
|
|
+SYSTEM = _platform.system()
|
|
|
+IS_OSX = SYSTEM == "Darwin"
|
|
|
+
|
|
|
STARTUP_INFO_FMT = """
|
|
|
Configuration ->
|
|
|
. broker -> %(conninfo)s
|
|
@@ -305,6 +309,13 @@ class Worker(object):
|
|
|
max_tasks_per_child=self.max_tasks_per_child,
|
|
|
task_time_limit=self.task_time_limit,
|
|
|
task_soft_time_limit=self.task_soft_time_limit)
|
|
|
+ self.install_platform_tweaks(worker)
|
|
|
+ worker.start()
|
|
|
+
|
|
|
+ def install_platform_tweaks(self, worker):
|
|
|
+ """Install platform specific tweaks and workarounds."""
|
|
|
+ if IS_OSX:
|
|
|
+ self.osx_proxy_detection_workaround()
|
|
|
|
|
|
# Install signal handler so SIGHUP restarts the worker.
|
|
|
if not self._isatty:
|
|
@@ -315,7 +326,10 @@ class Worker(object):
|
|
|
install_worker_term_handler(worker)
|
|
|
install_worker_int_handler(worker)
|
|
|
signals.worker_init.send(sender=worker)
|
|
|
- worker.start()
|
|
|
+
|
|
|
+ def osx_proxy_detection_workaround(self):
|
|
|
+ """See http://github.com/ask/celery/issues#issue/161"""
|
|
|
+ os.environ.setdefault("celery_dummy_proxy", "set_by_celeryd")
|
|
|
|
|
|
|
|
|
def install_worker_int_handler(worker):
|