kaxil commented on a change in pull request #20567:
URL: https://github.com/apache/airflow/pull/20567#discussion_r777798358
##########
File path: docs/apache-airflow/concepts/params.rst
##########
@@ -15,50 +15,140 @@
specific language governing permissions and limitations
under the License.
+.. _concepts:params:
+
Params
======
-Params are Airflow's concept of providing runtime configuration to tasks when
a DAG gets triggered manually.
-Params are configured while defining the DAG & tasks, that can be altered
while doing a manual trigger. The
-ability to update params while triggering a DAG depends on the flag
``core.dag_run_conf_overrides_params``,
-so if that flag is ``False``, params would behave like constants.
+Params are how Airflow provides runtime configuration to tasks.
+When you trigger a DAG manually, you can modify its Params before the dagrun
starts.
+If the user-supplied values don't pass validation, Airflow shows a warning
instead of creating the dagrun.
+(For scheduled runs, the default values are used.)
+
+Adding Params to a DAG
+----------------------
-To use them, one can use the ``Param`` class for complex trigger-time
validations or simply use primitive types,
-which won't be doing any such validations.
+To add Params to a :class:`~airflow.models.dag.DAG`, initialize it with the
``params`` kwarg.
+Use a dictionary that maps Param names to a either a
:class:`~airflow.models.param.Param` or an object indicating the parameter's
default value.
.. code-block::
from airflow import DAG
from airflow.models.param import Param
with DAG(
- 'my_dag',
+ "the_dag",
+ params={"x": Param(5, type="integer", minimum=3),
+ "y": 6},
+ ) as the_dag:
Review comment:
```suggestion
"the_dag",
params={
"x": Param(5, type="integer", minimum=3),
"y": 6
},
) as the_dag:
```
nit
--
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]