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/24 08:49:41 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #9475: Add extra links endpoint

turbaszek commented on a change in pull request #9475:
URL: https://github.com/apache/airflow/pull/9475#discussion_r444742601



##########
File path: airflow/api_connexion/endpoints/extra_link_endpoint.py
##########
@@ -15,12 +15,41 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# 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
 
+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
 
-def get_extra_links():
+
+@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", detail=f'DAG with ID = "{dag_id}" not found')

Review comment:
       Should we create `DagNotFound` and `TaskNotFound` exceptions to unify this between endpoints? 




----------------------------------------------------------------
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