Skip to content

[BREAKING] refactor: rename GpuPlatformInfo.gpus to .devices#33

Merged
kaiitunnz merged 1 commit into
mainfrom
kaiitunnz/refactor/gpu-devices
May 11, 2026
Merged

[BREAKING] refactor: rename GpuPlatformInfo.gpus to .devices#33
kaiitunnz merged 1 commit into
mainfrom
kaiitunnz/refactor/gpu-devices

Conversation

@kaiitunnz
Copy link
Copy Markdown
Collaborator

@kaiitunnz kaiitunnz commented May 11, 2026

Purpose

GpuPlatformInfo.gpus reads awkwardly at every call site (gpu.gpus). Rename to devices so the access reads naturally as gpu.devices. Hard rename — no compat shim, the wire format breaks; coordinate with a full server+worker restart and flush any cached worker registry entries in Redis on deploy.

Changes

  • src/shared/tasks/worker_message.py, src/server/schemas/node.py, sdk/src/flowmesh/models/workers.py — rename GpuPlatformInfo.gpus field to devices.
  • src/worker/hw.py — rename local gpus accumulator and GpuPlatformInfo(...) kwarg.
  • src/server/dispatcher/worker_selector.py, src/server/registries/worker.py, src/server/services/metrics.py — update all .gpus reads to .devices; rename matching local vars where the read flows straight in.
  • tests/worker/test_hw.py, tests/server/dispatcher/test_worker_selector.py, tests/server/registries/test_worker_registry.py, tests/sdk/test_models.py — update attribute reads and constructor kwargs.

Design

The model is mirrored across three packages (shared, server.schemas, flowmesh-sdk) and tests/sdk/test_schema_compat.py asserts the server↔SDK schemas stay in sync, so all three renames ship together. Local variables named gpus that hold a list[GpuInfo] are renamed to devices only where the read site or write site benefits from the consistency; standalone list[GpuInfo] locals that are not field-sourced were left as-is.

Wire-format compatibility is intentionally not preserved — the repo is pre-release and adding a Pydantic alias would leave the misleading field name in API docs.

Test Plan

uv run pytest tests/sdk tests/server tests/worker/test_hw.py --ignore=tests/worker/test_mp_executor_cleanup_gpu.py
uv run pre-commit run --all-files

Test Result

Not run locally — relying on CI. Refactor is mechanical and was verified by grep: no \.gpus or gpus= references to the renamed field remain (other *gpus hits are unrelated names like available_gpus, n_gpus).


Pre-submission Checklist
  • I have read the contribution guidelines.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added or updated tests covering my changes (if applicable).
  • I have verified that uv run pytest tests/ passes locally.
  • If I changed shared schemas or proto definitions, I have checked downstream compatibility across Server and Worker.
  • If I changed the SDK or CLI, I have verified the affected packages work (uv sync --all-packages --group ci --frozen).
  • If this is a breaking change, I have prefixed the PR title with [BREAKING] and described migration steps above.
  • I have updated documentation or config examples if user-facing behavior changed.

@kaiitunnz kaiitunnz changed the title refactor: rename GpuPlatformInfo.gpus to .devices [BREAKING] refactor: rename GpuPlatformInfo.gpus to .devices May 11, 2026
@kaiitunnz kaiitunnz requested a review from timzsu May 11, 2026 11:43
Copy link
Copy Markdown
Collaborator

@timzsu timzsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

`gpu.gpus` reads awkwardly at call sites; the field is the list of GPU
devices, so `.devices` reads naturally as `gpu.devices`.

Signed-off-by: Noppanat Wadlom <noppanat.wad@gmail.com>
@kaiitunnz kaiitunnz force-pushed the kaiitunnz/refactor/gpu-devices branch from 151cbc5 to e67b291 Compare May 11, 2026 12:06
@kaiitunnz kaiitunnz merged commit 47a9bb1 into main May 11, 2026
11 checks passed
@kaiitunnz kaiitunnz deleted the kaiitunnz/refactor/gpu-devices branch May 11, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants