This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 78c81f735c2507085bc2a4712d4527642097ba9b
Author: Amir Amangeldi <[email protected]>
AuthorDate: Sun Apr 26 12:48:11 2020 -0400

    Monkey patch greenlet celery pools (#8559)
    
    Celery pools of type eventlet and gevent use greenlets,
    which requires monkey patching the app:
    https://eventlet.net/doc/patching.html#monkey-patch
    
    Otherwise task instances hang on the workers and are never
    executed.
    
    (cherry picked from commit 9d7dab4c404b2025729509b85558cf0705cb7ccb)
---
 airflow/bin/cli.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py
index 4239701..eec216e 100644
--- a/airflow/bin/cli.py
+++ b/airflow/bin/cli.py
@@ -1092,6 +1092,7 @@ def worker(args):
 
     # Celery worker
     from airflow.executors.celery_executor import app as celery_app
+    from celery import maybe_patch_concurrency
     from celery.bin import worker
 
     autoscale = args.autoscale
@@ -1112,7 +1113,14 @@ def worker(args):
     }
 
     if conf.has_option("celery", "pool"):
-        options["pool"] = conf.get("celery", "pool")
+        pool = conf.get("celery", "pool")
+        options["pool"] = pool
+        # Celery pools of type eventlet and gevent use greenlets, which
+        # requires monkey patching the app:
+        # https://eventlet.net/doc/patching.html#monkey-patch
+        # Otherwise task instances hang on the workers and are never
+        # executed.
+        maybe_patch_concurrency(['-P', pool])
 
     if args.daemon:
         pid, stdout, stderr, log_file = setup_locations("worker",

Reply via email to