jscheffl commented on code in PR #44433:
URL: https://github.com/apache/airflow/pull/44433#discussion_r1864421800


##########
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:
   As answer above. Actually in all internals I want to have `int` just the 
connexion wrapper entry uses `str`to work-around the flask negative int value 
limitation



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