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


##########
providers/src/airflow/providers/edge/worker_api/routes/_v2_routes.py:
##########
@@ -268,3 +265,40 @@ 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."""
+    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."""
+    try:
+        auth = request.headers.get("Authorization", "")
+        jwt_token_authorization(request.path, auth)
+        request_obj = PushLogsBody(
+            log_chunk_data=body["log_chunk_data"], 
log_chunk_time=body["log_chunk_time"]
+        )
+        with create_session() as session:
+            push_logs(dag_id, task_id, run_id, try_number, int(map_index), 
request_obj, session)

Review Comment:
   The map_index not being an int comes back - even in copilot reviews 
@jscheffl 🙅‍♂️ 



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