ashb commented on a change in pull request #4884: [AIRFLOW-4015] Add 
get_dag_runs GET endpoint to "classic" API
URL: https://github.com/apache/airflow/pull/4884#discussion_r264000467
 
 

 ##########
 File path: airflow/www/api/experimental/endpoints.py
 ##########
 @@ -106,6 +107,28 @@ def delete_dag(dag_id):
     return jsonify(message="Removed {} record(s)".format(count), count=count)
 
 
+@api_experimental.route('/dags/<string:dag_id>/dag_runs', methods=['GET'])
+@requires_authentication
+def dag_runs(dag_id):
+    """
+    Returns a list of Dag Runs for a specific DAG ID.
+    :query param state: a query string parameter 
'?state=queued|running|success...'
+    :param dag_id: String identifier of a DAG
+    :return: List of DAG runs of a DAG with requested state,
+    or all runs if the state is not specified
+    """
+    try:
+        state = request.args.get('state')
+        dagruns = get_dag_runs(dag_id, state, run_url_route='airflow.graph')
+    except AirflowException as err:
+        _log.info(err)
+        response = jsonify(error="{}".format(err))
 
 Review comment:
   Good question, I just copied the original PR verbatim. I should have linked 
to that but forgot

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to