vchiapaikeo commented on code in PR #35403:
URL: https://github.com/apache/airflow/pull/35403#discussion_r1406878214
##########
airflow/www/views.py:
##########
@@ -3527,13 +3527,15 @@ def grid_data(self):
with create_session() as session:
query = select(DagRun).where(DagRun.dag_id == dag.dag_id,
DagRun.execution_date <= base_date)
- run_type = request.args.get("run_type")
- if run_type:
- query = query.where(DagRun.run_type == run_type)
-
- run_state = request.args.get("run_state")
- if run_state:
- query = query.where(DagRun.state == run_state)
+ run_type_raw = request.args.get("run_type")
+ if run_type_raw:
+ run_types = {run_type.strip() for run_type in
run_type_raw.split(",")}
+ query = query.where(DagRun.run_type.in_(run_types))
+
+ run_state_raw = request.args.get("run_state")
+ if run_state_raw:
+ run_states = {run_state.strip() for run_state in
run_state_raw.split(",")}
+ query = query.where(DagRun.state.in_(run_states))
Review Comment:
I went back and forth with this. The reason I ended up going with CSV here
is because it is backwards compatible. For example, Airflow users today might
have a URL like this saved:
`my-airflow-server.com/dags/my_dag/grid?run_state=queued`
If we were to change the argument to a list, this URL would be broken. For
it to work, it would need to look something like this:
`my-airflow-server.com/dags/my_dag/grid?run_state[]=queued`
By keeping it as a CSV, a single value would look the same as multiple
values:
`my-airflow-server.com/dags/my_dag/grid?run_state=queued`
`my-airflow-server.com/dags/my_dag/grid?run_state=queued%2Csuccess%2Crunning`
--
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]