aglinxinyuan opened a new pull request, #5553: URL: https://github.com/apache/texera/pull/5553
### What changes were proposed in this PR? Pin behavior of `WorkerBatchInternalQueue` — the per-DP-thread mailbox trait used by the Python worker. Previously uncovered; the only uncovered module in the `pythonworker` package whose contract is unit-testable without standing up a real Python subprocess. No production-code changes. | Spec | Source class | Tests | | --- | --- | --- | | `WorkerBatchInternalQueueSpec` | `WorkerBatchInternalQueue` (trait + companion) | 17 | Spec file name follows the `<srcClassName>Spec.scala` one-to-one convention. **Behavior pinned** | Surface | Contract | | --- | --- | | `enqueueData` + `getElement` | round-trip a `DataElement` (with both `DataFrame` and `StateFrame` payloads) | | `enqueueCommand` + `getElement` | round-trip a `ControlElement` | | `enqueueActorCommand` + `getElement` | round-trip an `ActorCommandElement` | | Multi-priority dispatch | control elements are returned **before** data elements when both are queued (sub-queue 0 < 1) | | FIFO within the control queue | `ControlElement` enqueued first comes out before `ActorCommandElement` enqueued second | | `getDataQueueLength` | reports only data-queue items (control is excluded) | | `getControlQueueLength` / `isControlQueueEmpty` | report all control-queue items (`ControlElement` + `ActorCommandElement`) | | `disableDataQueue` | hides queued data from `getElement` until `enableDataQueue` is called; control flow still moves | | `getQueuedCredit(sender)` | `0` initially; tracks bytes-in minus bytes-out for `DataFrame` payloads per sender; stays `0` for control / `StateFrame` payloads; per-sender accounting is independent; accumulates across multiple enqueues for the same sender | | Companion constants | `CONTROL_QUEUE == 0`, `DATA_QUEUE == 1`, and `CONTROL_QUEUE < DATA_QUEUE` (relied on by the multi-priority semantics) | The trait is exercised through a small test-only subclass (`class TestQueue extends WorkerBatchInternalQueue`), with `DirectControlMessagePayload` represented by a local marker case object since the production trait carries no behavior. ### Any related issues, documentation, discussions? Closes #5552. ### How was this PR tested? Pure unit-test addition; verified locally with: - `sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.pythonworker.WorkerBatchInternalQueueSpec"` — 17 tests, all green - `sbt scalafmtCheckAll` — clean - CI to confirm ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Sonnet 4.5) -- 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]
