You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/29 21:56:48 UTC
[GitHub] [airflow] kaxil commented on a change in pull request #11956: Speed up task execution in Celery by pre-loading "expensive" modules
kaxil commented on a change in pull request #11956:
URL: https://github.com/apache/airflow/pull/11956#discussion_r514591160
##########
File path: airflow/executors/celery_executor.py
##########
@@ -166,6 +167,31 @@ def send_task_to_executor(task_tuple: TaskInstanceInCelery) \
return key, command, result
+# pylint: disable=unused-import
+@celery_import_modules.connect
+def on_celery_import_modules(*args, **kwargs):
+ """
+ Preload some "expensive" airflow modules so that every task process doesn't have to import it again and
+ again.
+
+ Loading these for each task adds 0.3-0.5s _per task_ before the task can run. For long running tasks this
+ doesn't matter, but for short tasks this starts to be a noticable impact
Review comment:
```suggestion
doesn't matter, but for short tasks this starts to be a noticeable impact
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org