pierrejeambrun commented on code in PR #27805:
URL: https://github.com/apache/airflow/pull/27805#discussion_r1033022940


##########
airflow/www/views.py:
##########
@@ -1855,6 +1855,19 @@ def trigger(self, session=None):
             flash(f"Cannot create dagruns because the dag {dag_id} has import 
errors", "error")
             return redirect(origin)
 
+        recent_confs = (
+            session.query(DagRun.conf)
+            .filter(
+                DagRun.dag_id == dag_id,
+                DagRun.run_type == DagRunType.MANUAL,
+                DagRun.conf is not None,
+            )
+            .order_by(DagRun.execution_date.desc())
+            .limit(5)
+            .all()
+        )
+        recent_confs = [getattr(conf, "conf") for conf in recent_confs]

Review Comment:
   Conf are not always json compatible. I believe they can be plain `str`. 
check `def encode_dag_run` func. We may want to also handle this case. Maybe we 
can extract a reusable function that will handle the conf the same way that is 
done in `encode_dag_run`. (`json.dumps` if possible, otherwise `str`, and also 
returns `conf_is_json`, then we skip the conf that are not json in the response)



-- 
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-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to