You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/22 17:59:53 UTC
[GitHub] [airflow] OmairK commented on a change in pull request #9475: Add extra links endpoint
OmairK commented on a change in pull request #9475:
URL: https://github.com/apache/airflow/pull/9475#discussion_r443731489
##########
File path: airflow/api_connexion/endpoints/extra_link_endpoint.py
##########
@@ -18,9 +18,41 @@
# TODO(mik-laj): We have to implement it.
# Do you want to help? Please look at: https://github.com/apache/airflow/issues/8140
+from flask import current_app
-def get_extra_links():
+from airflow import DAG
+from airflow.api_connexion.exceptions import NotFound
+from airflow.exceptions import TaskNotFound
+from airflow.models.dagbag import DagBag
+from airflow.models.dagrun import DagRun as DR
+from airflow.utils.session import provide_session
+
+
+@provide_session
+def get_extra_links(dag_id: str, dag_run_id: str, task_id: str, session):
"""
Get extra links for task instance
"""
- raise NotImplementedError("Not implemented yet.")
+ dagbag: DagBag = current_app.dag_bag
+ dag: DAG = dagbag.get_dag(dag_id)
+ if not dag:
+ raise NotFound("DAG not found")
Review comment:
```suggestion
raise NotFound(detail=f"DAG with id: '{dag_id}' not found")
```
The errors are a bit more descriptive this way, what do you think?
----------------------------------------------------------------
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:
users@infra.apache.org