potiuk commented on a change in pull request #6740: [AIRFLOW-6181] Add 
InProcessExecutor
URL: https://github.com/apache/airflow/pull/6740#discussion_r355573995
 
 

 ##########
 File path: airflow/executors/inprocess_executor.py
 ##########
 @@ -0,0 +1,152 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+This module contains InProcessExecutor that is a single
+process executor meaning it does not use multiprocessing.
+"""
+
+import threading
+from typing import Any, Dict, List, Optional
+
+from airflow import conf
+from airflow.executors.base_executor import BaseExecutor
+from airflow.models.taskinstance import TaskInstance, TaskInstanceKeyType
+from airflow.utils.state import State
+
+
+class InProcessExecutor(BaseExecutor):
+    """
+    This executor is meant for debugging purposes. It can be used with
 
 Review comment:
   > My main thought is where is this useful, that `airflow test` isn't? I 
remember reading somewhere about using `airflow test` as the entrypoint for IDE.
   
   In all other executors the main process is running subprocess.popen. That 
prevents python debuggers from debugging then new process forked as the 
results. So you cannot set breakpoint and hit "Debug" to get it working. The 
only way we could find so far was remote debugging, but it requires paid 
version of IntelliJ and it is rather complex to run. 
   
   With this setting you go back to a "sane" way of debugging DAGs -you just 
add those two lines, set the breakpoint and use "Debug". I am not aware of any 
simple way of doing with with starting subprocesses. Unless  someone knows it 
(but I have not heard it so far).
   
   Moreover with this we will also be able to debug the code inside Breeze 
using Docker integration (in the same super-intuitive and easy way). You just 
add two lines to your DAG, set your environment to point to your Docker 
image/container and you can use all the debugging features of your IDE out of 
the box to not only initialize but also execute your DAG. This is 
super-powerful. We are going to use it at our workshops we have this Friday and 
this is so much easier for the users to debug the DAGs this way. Even if you 
use other IDEs which have good debugging integration, it's going to be super 
easy because you debug it in exactly the same way as you debug other python 
programs (which means it will just work).
   
   I know @feluelle  tried it before but could not make it work with the other 
executors.
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to