kaxil commented on code in PR #44330:
URL: https://github.com/apache/airflow/pull/44330#discussion_r1862841118


##########
providers/src/airflow/providers/edge/worker_api/routes/_v2_routes.py:
##########
@@ -87,3 +88,43 @@ def set_state_v2(worker_name: str, body: dict[str, Any], 
session=NEW_SESSION) ->
         return set_state(worker_name, request_obj, session)
     except HTTPException as e:
         return e.to_response()  # type: ignore[attr-defined]
+
+
+def logfile_path_v2(
+    dag_id: str,
+    task_id: str,
+    run_id: str,
+    try_number: int,
+    map_index: str,  # Note: Connexion can not have negative numbers in path 
parameters, use string therefore
+) -> str:
+    """Handle Edge Worker API 
`/edge_worker/v1/logs/logfile_path/{dag_id}/{task_id}/{run_id}/{try_number}/{map_index}`
 endpoint for Airflow 2.10."""
+    from flask import request
+
+    try:
+        auth = request.headers.get("Authorization", "")
+        jwt_token_authorization(request.path, auth)
+        return logfile_path(dag_id, task_id, run_id, try_number, 
int(map_index))
+    except HTTPException as e:
+        return e.to_response()  # type: ignore[attr-defined]
+
+
+def push_logs_v2(
+    dag_id: str,
+    task_id: str,
+    run_id: str,
+    try_number: int,
+    map_index: str,  # Note: Connexion can not have negative numbers in path 
parameters, use string therefore
+    body: dict[str, Any],
+) -> None:
+    """Handle Edge Worker API 
`/edge_worker/v1/logs/push/{dag_id}/{task_id}/{run_id}/{try_number}/{map_index}`
 endpoint for Airflow 2.10."""
+    from flask import request

Review Comment:
   Why is flask import not at top of the file?



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