jedcunningham commented on code in PR #23592:
URL: https://github.com/apache/airflow/pull/23592#discussion_r964312268
##########
docs/apache-airflow/howto/dynamic-dag-generation.rst:
##########
@@ -133,13 +134,16 @@ As long as a ``DAG`` object in ``globals()`` is created,
Airflow will load it.
print_message(config["message"])
- globals()[dag_id] = dynamic_generated_dag()
+ dynamic_generated_dag()
The code below will generate a DAG for each config:
``dynamic_generated_dag_config1`` and ``dynamic_generated_dag_config2``.
Each of them can run separately with related configuration
Review Comment:
```suggestion
Each of them can run separately with related configuration.
If you do not wish to have DAGs auto-registered, you can disable the
behavior by setting ``auto_register=False`` on your DAG.
```
##########
docs/apache-airflow/howto/dynamic-dag-generation.rst:
##########
@@ -107,8 +107,9 @@ the meta-data file in your DAG easily. The location of the
file to read can be f
# Configuration dict is available here
-Dynamic DAGs with ``globals()``
-...............................
+Registering dynamic DAGs
+........................
+
You can dynamically generate DAGs by working with ``globals()``.
As long as a ``DAG`` object in ``globals()`` is created, Airflow will load it.
Review Comment:
Maybe something like this instead?
```suggestion
You can dynamically generate DAGs when using the ``@dag`` decorator or the
``with DAG(..)`` context manager.
Airflow will automatically register them.
```
##########
newsfragments/23592.significant.rst:
##########
@@ -0,0 +1,24 @@
+DAGS used in a context manager no longer need to be assigned to a module
variable
Review Comment:
This should also cover the `@dag` decorator, no?
##########
docs/apache-airflow/howto/dynamic-dag-generation.rst:
##########
@@ -133,13 +134,16 @@ As long as a ``DAG`` object in ``globals()`` is created,
Airflow will load it.
print_message(config["message"])
- globals()[dag_id] = dynamic_generated_dag()
+ dynamic_generated_dag()
The code below will generate a DAG for each config:
``dynamic_generated_dag_config1`` and ``dynamic_generated_dag_config2``.
Review Comment:
```suggestion
The code above will generate a DAG for each config:
``dynamic_generated_dag_config1`` and ``dynamic_generated_dag_config2``.
```
--
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]