You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/05/08 13:12:47 UTC
[airflow] 04/36: Show warning if '/' is used in a DAG run ID (#23106)
This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 605dbd08bc91fba4fe0c1f08f6e240e178028794
Author: Tzu-ping Chung <tp...@astronomer.io>
AuthorDate: Tue May 3 15:22:12 2022 -0600
Show warning if '/' is used in a DAG run ID (#23106)
(cherry picked from commit 451c7cbc42a83a180c4362693508ed33dd1d1dab)
---
airflow/models/dag.py | 8 ++++++++
airflow/www/views.py | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/airflow/models/dag.py b/airflow/models/dag.py
index 527928adb9..25da5b9489 100644
--- a/airflow/models/dag.py
+++ b/airflow/models/dag.py
@@ -2301,6 +2301,14 @@ class DAG(LoggingMixin):
"Creating DagRun needs either `run_id` or both `run_type` and `execution_date`"
)
+ if run_id and "/" in run_id:
+ warnings.warn(
+ "Using forward slash ('/') in a DAG run ID is deprecated. Note that this character "
+ "also makes the run impossible to retrieve via Airflow's REST API.",
+ DeprecationWarning,
+ stacklevel=3,
+ )
+
logical_date = timezone.coerce_datetime(execution_date)
if data_interval is None and logical_date is not None:
warnings.warn(
diff --git a/airflow/www/views.py b/airflow/www/views.py
index d6103b1bc3..bc065db6b8 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1904,6 +1904,14 @@ class Airflow(AirflowBaseView):
flash(f"The run_id {dr.run_id} already exists", "error")
return redirect(origin)
+ # Flash a warning when slash is used, but still allow it to continue on.
+ if run_id and "/" in run_id:
+ flash(
+ "Using forward slash ('/') in a DAG run ID is deprecated. Note that this character "
+ "also makes the run impossible to retrieve via Airflow's REST API.",
+ "warning",
+ )
+
run_conf = {}
if request_conf:
try: