potiuk commented on code in PR #40205:
URL: https://github.com/apache/airflow/pull/40205#discussion_r1639254923


##########
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:
   How about another option:
   
   * keep dags.test() running always using `_run_raw_task` 
   * add an option `--use-executor EXECUTOR`  and pass it as 
test(use_executor=...) 
   
   Where the `EXECUTOR` could be `default` or selected executor
   
   I think that would be much more future-friendly, when we have multiple 
executors, you will be able to choose which executor should be used to run the 
test.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to