You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ephraimbuddy (via GitHub)" <gi...@apache.org> on 2023/06/07 06:43:51 UTC
[GitHub] [airflow] ephraimbuddy commented on a diff in pull request #31301: Allow optional defaults in required fields with manual triggered dags
ephraimbuddy commented on code in PR #31301:
URL: https://github.com/apache/airflow/pull/31301#discussion_r1220955420
##########
airflow/example_dags/example_params_ui_tutorial.py:
##########
@@ -278,13 +276,8 @@
},
) as dag:
- @task(task_id="show_params")
- def show_params(**kwargs) -> None:
- ti: TaskInstance = kwargs["ti"]
- dag_run: DagRun = ti.dag_run
- if not dag_run.conf:
- print("Uups, no parameters supplied as DagRun.conf, was the trigger w/o form?")
- raise AirflowSkipException("No DagRun.conf parameters supplied.")
- print(f"This DAG was triggered with the following parameters:\n{json.dumps(dag_run.conf, indent=4)}")
+ @task
+ def show_params(params: ParamsDict = dag.params) -> None:
+ print(f"This DAG was triggered with the following parameters:\n\n{json.dumps(params, indent=4)}\n")
Review Comment:
Is this change necessary? Can't we print the output of `dag_run.conf`?
--
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