Browse Source

Jython fixes. Closes celery/billiard#38

Ask Solem 12 years ago
parent
commit
b9fd9f6944
2 changed files with 7 additions and 3 deletions
  1. 5 2
      celery/app/base.py
  2. 2 1
      celery/apps/worker.py

+ 5 - 2
celery/app/base.py

@@ -18,7 +18,10 @@ from contextlib import contextmanager
 from copy import deepcopy
 from functools import wraps
 
-from billiard import forking as _forking
+try:
+    from billiard import forking as _forking
+except ImportError:
+    _forking = None
 from billiard.util import register_after_fork
 from kombu.clocks import LamportClock
 from kombu.utils import cached_property
@@ -415,7 +418,7 @@ class Celery(object):
         # is enabled.  There may be a better way to do this, but attempts
         # at forcing the subprocess to import the modules did not work out,
         # apparently some sys.path problem.  More at Issue 1126.
-        conf = (self.conf.changes if _forking._forking_is_enabled
+        conf = (self.conf.changes if _forking and _forking._forking_is_enabled
                 else self.conf._pickleable_changes())
         return (self.main, conf, self.loader_cls,
                 self.backend_cls, self.amqp_cls, self.events_cls,

+ 2 - 1
celery/apps/worker.py

@@ -336,7 +336,8 @@ if not is_jython:
         _shutdown_handler, sig='SIGQUIT', how='Cold', exc=SystemTerminate,
     )
 else:
-    install_worker_term_handler = lambda *a, **kw: None
+    install_worker_term_handler = \
+        install_worker_term_hard_handler = lambda *a, **kw: None
 
 
 def on_SIGINT(worker):