Explorar o código

Jython: Threads is now default under jython, and depends on threadpool + simplejson

Ask Solem %!s(int64=14) %!d(string=hai) anos
pai
achega
94d7694b37
Modificáronse 2 ficheiros con 13 adicións e 2 borrados
  1. 7 1
      celery/app/defaults.py
  2. 6 1
      setup.py

+ 7 - 1
celery/app/defaults.py

@@ -1,5 +1,11 @@
+import sys
+
 from datetime import timedelta
 
+is_jython = sys.platform.startswith("java")
+
+DEFAULT_POOL = is_jython and "threads" or "processes"
+
 DEFAULT_PROCESS_LOG_FMT = """
     [%(asctime)s: %(levelname)s/%(processName)s] %(message)s
 """.strip()
@@ -105,7 +111,7 @@ NAMESPACES = {
         "LOG_FILE": Option(),
         "MEDIATOR": Option("celery.worker.controllers.Mediator"),
         "MAX_TASKS_PER_CHILD": Option(type="int"),
-        "POOL": Option("celery.concurrency.processes.TaskPool"),
+        "POOL": Option(DEFAULT_POOL),
         "POOL_PUTLOCKS": Option(True, type="bool"),
         "PREFETCH_MULTIPLIER": Option(4, type="int"),
         "STATE_DB": Option(),

+ 6 - 1
setup.py

@@ -54,11 +54,16 @@ install_requires.extend([
     "pyparsing>=1.5.0",
 ])
 py_version = sys.version_info
-if sys.version_info < (2, 6) and not sys.platform.startswith("java"):
+is_jython = sys.platform.startswith("java")
+if sys.version_info < (2, 6) and not is_jython:
     install_requires.append("multiprocessing")
 if sys.version_info < (2, 5):
     install_requires.append("uuid")
 
+if is_jython:
+    install_requires.append("threadpool")
+    install_requires.append("simplejson")
+
 if os.path.exists("README.rst"):
     long_description = codecs.open("README.rst", "r", "utf-8").read()
 else: