jscheffl commented on code in PR #45958:
URL: https://github.com/apache/airflow/pull/45958#discussion_r1937984160
##########
providers/edge/src/airflow/providers/edge/cli/api_client.py:
##########
@@ -103,15 +104,16 @@ def worker_register(
def worker_set_state(
hostname: str, state: EdgeWorkerState, jobs_active: int, queues: list[str]
| None, sysinfo: dict
-) -> list[str] | None:
+) -> WorkerSetStateReturn:
"""Update the state of the worker in the central site and thereby
implicitly heartbeat."""
- return _make_generic_request(
+ result = _make_generic_request(
"PATCH",
f"worker/{quote(hostname)}",
WorkerStateBody(state=state, jobs_active=jobs_active, queues=queues,
sysinfo=sysinfo).model_dump_json(
exclude_unset=True
),
)
+ return WorkerSetStateReturn(**result["__data__"])
Review Comment:
...and to send correct JSON as response in v2 you need to change
providers/edge/src/airflow/providers/edge/worker_api/routes/_v2_routes.py:156
to dump the pydantic class as JSON:
```
return set_state(worker_name, request_obj, session).model_dump()
```
--
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]