ashb 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_r280027042
##########
File path: airflow/www/api/experimental/endpoints.py
##########
@@ -41,6 +47,124 @@
api_experimental = Blueprint('api_experimental', __name__)
+@api_experimental.route(
+
'/dags/<string:dag_id>/dag_runs/<string:execution_date>/tasks/<string:task_id>/logs',
+ methods=['GET'])
+@requires_authentication
+def logs(dag_id, execution_date, task_id):
+ """
+ Return logs for the specified task identified by dag_id, execution_date
and task_id
+ """
+ try:
+ log = get_task_logs(dag_id, task_id, execution_date)
+ except AirflowException as err:
+ _log.info(err)
+ response = jsonify(error="{}".format(err))
+ response.status_code = err.status_code
+ return response
+ except ValueError:
Review comment:
This error handling is overly broad and could catch a ValueError from
something else.
Additionally: I would like to see the conversion from string to dt object
here in this FN, not in side the common api part.
----------------------------------------------------------------
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