vincbeck commented on code in PR #40205:
URL: https://github.com/apache/airflow/pull/40205#discussion_r1638332941
##########
airflow/models/dag.py:
##########
@@ -2952,6 +2952,21 @@ def add_logger_if_needed(ti: TaskInstance):
# Instead of starting a scheduler, we run the minimal loop
possible to check
# for task readiness and dependency management. This is notably
faster
# than creating a BackfillJob and allows us to surface logs to the
user
+
+ from airflow.executors.local_executor import LocalExecutor
+
+ # Fetch the executor from config
+ # ``Dag.test()`` works in two different modes depending on the
executor:
+ # - if the executor is ``LocalExecutor``, runs the task locally
using ``_run_task``
+ # - if the executor is not ``LocalExecutor``, sends the task
instances to the executor with
+ # ``BaseExecutor.queue_task_instance``
Review Comment:
All executors are supported here, we just make the exception of
`LocalExecutor` which uses `_run_task`. The reason why I make this exception
is, today, `.test()` only run tasks locally with `_run_task` so I dont want to
break this behavior. Ultimately, we might want to remove this exception and all
executors would be handled the same way (2nd item in the list) with
`executor.queue_task_instance`.
Though, I tried to run a system using `executor.queue_task_instance` with
LocalExecutor and I got an error. But I think we can do that in another PR
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]