Eason09053360 opened a new pull request, #72959:
URL: https://github.com/apache/airflow/pull/72959

   ## Why
   
   `airflow edge list-workers` reports `concurrency` and `free_concurrency` as 
`null` for every worker, regardless of what the worker last heartbeated.
   
   The listing was written when `edge_worker.sysinfo` was a VARCHAR holding 
JSON text, so it ran `json.loads` on the value. Since #65472 (edge3 3.5.0) the 
column is a JSON type and SQLAlchemy already returns a `dict`. 
`json.loads(dict)` raises `TypeError`, the surrounding `except 
(json.JSONDecodeError, TypeError)` swallowed it, and both fields fell through 
to `None`. No error was ever shown, and the existing test only asserted the 
keys were present, so the regression went unnoticed.
   
   ## What
   
   - `providers/edge3/src/airflow/providers/edge3/cli/edge_command.py`: read 
`host.sysinfo` as the dict it already is. A non-dict value (`None` before the 
first heartbeat, or a stale row) still yields `null` rather than aborting the 
command, matching the previous degrade-to-null behaviour. The `fields` list no 
longer carries the two names that were only there to be filtered out again; 
output columns and their order are unchanged.
   - `providers/edge3/tests/unit/edge3/cli/test_worker.py`: 
`test_list_edge_workers` now sets a `sysinfo` dict on the mocked worker and 
asserts the reported values, so it fails on the old code.
   
   Not touched: `EdgeWorkerModel.concurrency` is the operator-requested 
override written by `set-concurrency`, not the value the worker actually runs 
with, so the CLI keeps reading the worker-reported `sysinfo` value like the UI 
does.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5.1)
   
   Generated-by: Claude Code (Fable 5.1) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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