Explorar o código

Updated celeryd to only listen for SIGHUP when running on POSIX systems (fix for running on windows).

Updated setuptools script (setup.py) to not include python-daemon dependency when running on windows.
Jonatan Heyman %!s(int64=15) %!d(string=hai) anos
pai
achega
98a0b3037a
Modificáronse 2 ficheiros con 20 adicións e 5 borrados
  1. 10 3
      celery/bin/celeryd.py
  2. 10 2
      setup.py

+ 10 - 3
celery/bin/celeryd.py

@@ -80,7 +80,12 @@ from celery import conf
 from celery import discovery
 from celery.task import discard_all
 from celery.worker import WorkController
-from signal import signal, SIGHUP
+from signal import signal
+# SIGHUP is only available on POSIX systems
+try:
+    from signal import SIGHUP
+except ImportError:
+    SIGHUP = None
 import multiprocessing
 import traceback
 import optparse
@@ -266,8 +271,10 @@ def run_worker(concurrency=DAEMON_CONCURRENCY, detach=False,
                                 logfile=logfile,
                                 is_detached=detach)
 
-        # Install signal handler that restarts celeryd on SIGHUP
-        install_restart_signal_handler(worker)
+        # Install signal handler that restarts celeryd on SIGHUP,
+        # if SIGHUP is imported, which means we are on a POSIX system
+        if SIGHUP != None:
+            install_restart_signal_handler(worker)
 
         try:
             worker.start()

+ 10 - 2
setup.py

@@ -42,8 +42,16 @@ class RunTests(Command):
 
 install_requires = ["django-unittest-depth",
                     "anyjson",
-                    "carrot>=0.5.2",
-                    "python-daemon"]
+                    "carrot>=0.5.2"]
+
+# python-daemon doesn't run on windows, so check current platform
+if sys.platform == "win32":
+    print
+    print "I see you are using windows. You will not be able to run celery in daemon mode with the --detach parameter."
+    print
+else:
+    install_requires.append("python-daemon")
+
 py_version_info = sys.version_info
 py_major_version = py_version_info[0]
 py_minor_version = py_version_info[1]