kaxil commented on code in PR #44433:
URL: https://github.com/apache/airflow/pull/44433#discussion_r1862846445
##########
providers/src/airflow/providers/edge/worker_api/routes/_v2_routes.py:
##########
@@ -90,6 +98,44 @@ def set_state_v2(worker_name: str, body: dict[str, Any],
session=NEW_SESSION) ->
return e.to_response() # type: ignore[attr-defined]
+@provide_session
+def job_fetch_v2(worker_name: str, body: dict[str, Any] | None = None,
session=NEW_SESSION) -> Any:
+ """Handle Edge Worker API `/edge_worker/v1/jobs/fetch/{worker_name}`
endpoint for Airflow 2.10."""
+ from flask import request
+
+ try:
+ auth = request.headers.get("Authorization", "")
+ jwt_token_authorization(request.path, auth)
+ queues = body["queues"] if body else None
+ free_concurrency = body["free_concurrency"] if body else 1
+ request_obj = WorkerQueuesBody(queues=queues,
free_concurrency=free_concurrency)
+ job: EdgeJobFetched | None = fetch(worker_name, request_obj, session)
+ return job.model_dump() if job is not None else None
+ except HTTPException as e:
+ return e.to_response() # type: ignore[attr-defined]
+
+
+@provide_session
+def job_state_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
Review Comment:
its str here why int above!
https://github.com/apache/airflow/pull/44433/commits/a7df2861cf97ae1c8e14b766bbb7b8d687058acc#r1862844010
--
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]