patricker commented on code in PR #24452:
URL: https://github.com/apache/airflow/pull/24452#discussion_r898214744


##########
docs/apache-airflow/dag-run.rst:
##########
@@ -265,8 +265,32 @@ Example of a parameterized DAG:
         dag=dag,
     )
 
+Example of a parameterized DAG that reads the configuration from the context:
+
+.. code-block:: python
+
+    import pendulum
+
+    from airflow import DAG
+    from airflow.operators.python import PythonOperator
+
+    dag = DAG(
+        "example_parameterized_dag",
+        schedule_interval=None,
+        start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
+        catchup=False,
+    )
+    
+    def print_conf(**context):
+        conf1 = context['dag_run'].conf['conf1']
+        print(conf1)
+
+    parameterized_task = PythonOperator(
+        task_id="parameterized_task",
+        python_callable=print_conf,
+        dag=dag,
+    )

Review Comment:
   I wrote it up slightly differently. Are you OK with my use of `context = 
get_current_context()`?



-- 
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]

Reply via email to