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 2020/10/23 14:27:54 UTC

[GitHub] [airflow] ashb commented on a change in pull request #10587: Add @dag decorator

ashb commented on a change in pull request #10587:
URL: https://github.com/apache/airflow/pull/10587#discussion_r510922910



##########
File path: docs/concepts.rst
##########
@@ -162,6 +162,32 @@ Example DAG with decorated style
         html_content=email_info['body']
     )
 
+DAG decorator
+-------------
+
+.. versionadded:: 2.0.0
+
+In addition to creating DAGs using context managed, in Airflow 2.0 you can also create DAGs from a function.
+DAG decorator creates a DAG generator function. This function when called returns a DAG.
+
+DAG decorator also sets up the parameters you have in the function as DAG params. This allows you to parameterize
+your DAGs and set the parameters when triggering the DAG manually. See
+:ref:`Passing Parameters when triggering dags <dagrun:parameters>` to learn how to pass parameters when triggering DAGs.
+
+You can also use the parameters on jinja templates by using the ``{{context.params}}`` dictionary.
+
+Example DAG with decorator:
+
+.. exampleinclude:: /../airflow/example_dags/example_dag_decorator.py
+    :language: python
+    :start-after: [START dag_decorator_usage]
+    :end-before: [END dag_decorator_usage]
+
+.. note:: Note that Airflow will only load DAGs that appear in ``globals()``. Which means you need to make sure to have

Review comment:
       ```suggestion
   .. note::
   
     Note that Airflow will only load DAGs that appear in ``globals()``. Which means you need to make sure to have
   ```




----------------------------------------------------------------
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:
users@infra.apache.org