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/06 19:42:03 UTC
[GitHub] [airflow] uranusjr commented on a diff in pull request #23592: Automatically register DAGs that are used in a context manager
uranusjr commented on code in PR #23592:
URL: https://github.com/apache/airflow/pull/23592#discussion_r964103714
##########
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:
This in-place operation feels a bit weird to me… Perhaps a context manager would be easier to understand and maintain? Something like
```python
with DagContext.enable_autoregister(mod_name):
parse(...)
```
--
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