jscheffl commented on code in PR #44330:
URL: https://github.com/apache/airflow/pull/44330#discussion_r1864356388
##########
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:
Fixed, yeah this was re-factored by me in-between and did not want to drag
depencencies in other code... and then decided to bring all Airflow 2 compat
stuff into a single module... moved to top level now. Good catch!
--
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]