goutamadwant opened a new pull request, #11909:
URL: https://github.com/apache/seatunnel/pull/11909
### Purpose of this pull request
Part of #11665.
This PR adds the backend-first worker resource view agreed in the issue
discussion.
- Reuses the existing `WorkerResourceDiagnostic` model and live
`WorkerProfile` state.
- Adds `GET /resource/workers` and the corresponding v1 REST endpoint.
- Exposes fixed-slot total, used, and free counts.
- Represents dynamic-slot workers without treating assigned plus unassigned
slots as fixed capacity.
- Exposes total and available CPU and heap resources from the latest worker
heartbeat.
- Returns explicit snapshot availability and collection time.
- Handles master election and membership changes as temporarily unavailable
snapshots.
- Preserves the existing serialized worker diagnostic contract for rolling
compatibility.
- Documents the endpoints in English and Chinese.
This does not change resource allocation or scheduling behavior. The Web UI
and task drill-down remain follow-up work after the backend contract is
reviewed.
### Does this PR introduce _any_ user-facing change?
Yes.
Users can query the current per-worker resource snapshot through:
- `GET /resource/workers`
- `GET /hazelcast/rest/maps/resource/workers`
The response includes worker address, tags, slot usage, dynamic-slot mode,
CPU and heap resources, system usage, running job IDs, snapshot availability,
and collection time.
### How was this patch tested?
Added focused coverage for:
- fixed-slot and dynamic-slot worker projections
- released and reused fixed slots
- incomplete worker heartbeat profiles
- empty and unavailable snapshots
- master-election and member-left handling
- unrelated forwarding failures
- Hazelcast operation registration
- servlet JSON output
Verified with:
```shell
mvn -o -pl seatunnel-engine/seatunnel-engine-server spotless:apply
mvn -o -pl seatunnel-engine/seatunnel-engine-server -DskipTests package
mvn -o -pl seatunnel-engine/seatunnel-engine-server \
-DskipITs -DskipIT -Dcheckstyle.skip -Dspotless.check.skip=true \
-Dtest=PendingDiagnosticsCollectorTest,GetWorkerResourcesOperationTest,WorkerResourceServiceTest,WorkerResourceServletTest,ResourceDataSerializerHookTest
\
test
./mvnw -q -DskipTests verify
```
The focused suite passed with 12 tests. Mockito's subclass mock maker was
used only for the local focused run because inline Byte Buddy attachment is
unavailable on macOS 26. The repository configuration is unchanged.
The existing and updated `WorkerResourceDiagnostic` forms were also
serialized and read in both directions to verify compatibility.
### Check list
* [x] No new Jar binary package is added.
* [x] English and Chinese REST API documentation is updated.
* [x] No incompatible change is introduced. The existing serialized
diagnostic fields and serial version are preserved.
* [x] This PR does not modify connector code, so the connector packaging
checklist is not applicable.
--
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]