Skip to content

Commit 6c20587

Browse files
author
Ask Solem
committed
Workaround for proxy autodetection on OS X. Closes celery#161. Thanks to gthb, ShawnMilo
1 parent 3b45376 commit 6c20587

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

celery/bin/celeryd.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import socket
6868
import logging
6969
import optparse
70+
import platform as _platform
7071
import warnings
7172
import multiprocessing
7273

@@ -81,6 +82,9 @@
8182
from celery.exceptions import ImproperlyConfigured
8283
from celery.routes import Router
8384

85+
SYSTEM = _platform.system()
86+
IS_OSX = SYSTEM == "Darwin"
87+
8488
STARTUP_INFO_FMT = """
8589
Configuration ->
8690
. broker -> %(conninfo)s
@@ -303,6 +307,13 @@ def run_worker(self):
303307
max_tasks_per_child=self.max_tasks_per_child,
304308
task_time_limit=self.task_time_limit,
305309
task_soft_time_limit=self.task_soft_time_limit)
310+
self.install_platform_tweaks(worker)
311+
worker.start()
312+
313+
def install_platform_tweaks(self, worker):
314+
"""Install platform specific tweaks and workarounds."""
315+
if IS_OSX:
316+
self.osx_proxy_detection_workaround()
306317

307318
# Install signal handler so SIGHUP restarts the worker.
308319
if not self._isatty:
@@ -313,7 +324,10 @@ def run_worker(self):
313324
install_worker_term_handler(worker)
314325
install_worker_int_handler(worker)
315326
signals.worker_init.send(sender=worker)
316-
worker.start()
327+
328+
def osx_proxy_detection_workaround(self):
329+
"""See http://github.com/ask/celery/issues#issue/161"""
330+
os.environ.setdefault("celery_dummy_proxy", "set_by_celeryd")
317331

318332

319333
def install_worker_int_handler(worker):

0 commit comments

Comments
 (0)