raviagarwalunravel commented on a change in pull request #5118: [AIRFLOW-4315]
Add monitoring API's to airflow
URL: https://github.com/apache/airflow/pull/5118#discussion_r280672063
##########
File path: airflow/www/api/experimental/endpoints.py
##########
@@ -150,23 +284,39 @@ def get_dag_code(dag_id):
return response
+@api_experimental.route('/dags/<string:dag_id>/tasks', methods=['GET'])
+@requires_authentication
+def tasks(dag_id):
+ """Returns a JSON with all tasks associated with the dag_id. """
+ try:
+ task_list = list()
+ task_ids = get_tasks(dag_id)
+ for task_id in task_ids:
+ task_list.append(get_task_as_dict(dag_id, task_id))
+
+ except AirflowException as err:
+ _log.info(err)
+ response = jsonify(error="{}".format(err))
+ response.status_code = err.status_code
+ return response
+
+ return jsonify(task_list)
Review comment:
where is info? but I have indeed moved the `task_list = list()` statement
above the try block.
----------------------------------------------------------------
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