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 2022/09/07 14:00:24 UTC

[GitHub] [airflow] ashb commented on a diff in pull request #23592: Automatically register DAGs that are used in a context manager

ashb commented on code in PR #23592:
URL: https://github.com/apache/airflow/pull/23592#discussion_r964884461


##########
airflow/models/dagbag.py:
##########
@@ -306,6 +314,8 @@ def _load_modules_from_file(self, filepath, safe_mode):
         if mod_name in sys.modules:
             del sys.modules[mod_name]
 
+        DagContext.current_autoregister_module_name = mod_name

Review Comment:
   Yeah, I agree, This is essentially used as a global variable.
   
   It's not very easy to refactor given it's use across three or so different functions, so a context manager would be tricky. (I.e. I can't see an easy refactor to make it work right now)



-- 
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-unsubscribe@airflow.apache.org

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