ashb commented on a change in pull request #21965:
URL: https://github.com/apache/airflow/pull/21965#discussion_r818715328



##########
File path: airflow/api_connexion/endpoints/task_instance_endpoint.py
##########
@@ -93,6 +93,54 @@ def get_task_instance(
     return task_instance_schema.dump(task_instance)
 
 
[email protected]_access(
+    [
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_DAG),
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_DAG_RUN),
+        (permissions.ACTION_CAN_READ, permissions.RESOURCE_TASK_INSTANCE),
+    ],
+)
+@provide_session
+def get_mapped_task_instance(
+    *,
+    dag_id: str,
+    dag_run_id: str,
+    task_id: str,
+    map_index: int,
+    session: Session = NEW_SESSION,
+) -> APIResponse:
+    """Get task instance"""
+    query = (
+        session.query(TI)
+        .filter(
+            TI.dag_id == dag_id, DR.run_id == dag_run_id, TI.task_id == 
task_id, TI.map_index == map_index
+        )
+        .join(TI.dag_run)
+        .outerjoin(
+            SlaMiss,
+            and_(
+                SlaMiss.dag_id == TI.dag_id,
+                SlaMiss.execution_date == DR.execution_date,
+                SlaMiss.task_id == TI.task_id,
+            ),

Review comment:
       TODO/note to future us: SlaMisss is going to need to be migrated to 
(dag_id,run_id,task_id,map_index) as it's PK soon




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to