Repository navigation
test(workflow-operator): route Python tests to amber-integration - #7207
Conversation
…egration The `amber` job runs this module's test suite and installs no Python packages. The runner's interpreter is there — PythonCodeRawInvalidTextSpec uses it for a stdlib-only py_compile check — but pandas and plotly are not importable, so a test that executes an operator's generated template rather than only compiling it fails its dependency probe and cancels. A cancellation is neither a pass nor a failure, so the suite still reports "All tests passed" and the missing coverage leaves no trace in the build. This gives WorkflowOperator the split amber already has, reading the same AMBER_TEST_FILTER the amber job sets on the step that invokes WorkflowOperator/jacoco, so that job needs no change for the exclusion to take effect. amber's tag cannot be reused: it lives in amber/src/test/integration, and amber depends on WorkflowOperator, not the other way around. With the selection logic now wanted in two modules it moves to project/TestFilters.scala, beside the build's other shared sbt helpers, and each module passes its own env var and tag. PythonCodeRawInvalidTextSpec gains a tagged case asserting that pandas and plotly import in the interpreter it already resolves: py_compile only parses the emitted code, while running it needs the packages it imports. Being the first user of the tag it also exercises the routing, and it turns a missing install in amber-integration into a failure rather than the silent cancellation above. Elsewhere a bare interpreter is a local-setup fact, so it cancels instead. Verified in all four states: with the packages present the case passes under integration-only; under skip-integration it is excluded while the spec's two existing tests still run; pointed at a bare interpreter it fails under integration-only and cancels with no filter set. Both modules' testOptions were compared under all three env values before and after the extraction. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7207 +/- ##
============================================
- Coverage 90.14% 90.12% -0.02%
+ Complexity 4417 4411 -6
============================================
Files 1174 1174
Lines 46964 46964
Branches 5262 5262
============================================
- Hits 42334 42326 -8
- Misses 2876 2878 +2
- Partials 1754 1760 +6
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 561 | 0.342 | 17,312/23,441/23,441 us | 🔴 +8.0% / 🔴 +43.4% |
| 🔴 | bs=100 sw=10 sl=64 | 1,178 | 0.719 | 82,545/113,751/113,751 us | 🔴 +5.1% / 🟢 -18.2% |
| 🔴 | bs=1000 sw=10 sl=64 | 1,365 | 0.833 | 727,976/821,040/821,040 us | 🔴 +6.3% / 🟢 +32.5% |
Baseline details
Latest main 324278e from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 561 tuples/sec | 605 tuples/sec | 774.89 tuples/sec | -7.3% | -27.6% |
| bs=10 sw=10 sl=64 | MB/s | 0.342 MB/s | 0.37 MB/s | 0.473 MB/s | -7.6% | -27.7% |
| bs=10 sw=10 sl=64 | p50 | 17,312 us | 16,026 us | 12,738 us | +8.0% | +35.9% |
| bs=10 sw=10 sl=64 | p95 | 23,441 us | 21,796 us | 16,348 us | +7.6% | +43.4% |
| bs=10 sw=10 sl=64 | p99 | 23,441 us | 21,796 us | 18,848 us | +7.6% | +24.4% |
| bs=100 sw=10 sl=64 | throughput | 1,178 tuples/sec | 1,174 tuples/sec | 1,005 tuples/sec | +0.3% | +17.3% |
| bs=100 sw=10 sl=64 | MB/s | 0.719 MB/s | 0.717 MB/s | 0.613 MB/s | +0.3% | +17.3% |
| bs=100 sw=10 sl=64 | p50 | 82,545 us | 81,722 us | 100,970 us | +1.0% | -18.2% |
| bs=100 sw=10 sl=64 | p95 | 113,751 us | 108,221 us | 107,605 us | +5.1% | +5.7% |
| bs=100 sw=10 sl=64 | p99 | 113,751 us | 108,221 us | 116,429 us | +5.1% | -2.3% |
| bs=1000 sw=10 sl=64 | throughput | 1,365 tuples/sec | 1,371 tuples/sec | 1,030 tuples/sec | -0.4% | +32.5% |
| bs=1000 sw=10 sl=64 | MB/s | 0.833 MB/s | 0.837 MB/s | 0.629 MB/s | -0.5% | +32.5% |
| bs=1000 sw=10 sl=64 | p50 | 727,976 us | 722,544 us | 991,433 us | +0.8% | -26.6% |
| bs=1000 sw=10 sl=64 | p95 | 821,040 us | 772,217 us | 1,036,668 us | +6.3% | -20.8% |
| bs=1000 sw=10 sl=64 | p99 | 821,040 us | 772,217 us | 1,070,470 us | +6.3% | -23.3% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,356.45,200,128000,561,0.342,17312.12,23441.13,23441.13
1,100,10,64,20,1698.50,2000,1280000,1178,0.719,82545.03,113750.77,113750.77
2,1000,10,64,20,14652.62,20000,12800000,1365,0.833,727975.59,821039.82,821039.82The javadoc explained what the tag means and how the build routes it, but not how a test opts in — and the two ScalaTest styles in this module take the tag in different positions. Naming both, and noting that per-case tagging keeps a spec's cheaper assertions in the unit job and its coverage report, saves the next reader a trip through build.sbt and ScalaTest's docs. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Testing operators one at a time does not scale when each one costs a spawn: the syntax check ran `python -I -S -B -m py_compile` once per descriptor, 117 of them serially, where the interpreter boot is the entire cost and the compile is under a millisecond. The check now goes through PythonWorkerPool -- a worker launched once with the same `-I -S` isolation, serving many sources over a line-delimited JSON protocol -- with the descriptors fanned out across the pool's workers, four at a time. 1119 ms to 310 ms, and a hard worker crash falls back to the spawn, so behavior is never worse than before. TEXERA_TEST_PYTHON_WORKER=0 selects the old path. The pool sits in this module's test scope, not beside its caller, because the tests this branch unblocks execute generated templates against pandas and plotly, where a spawn costs 260-310 ms and the imports are ~96% of it. Without a shared seam each such test hand-rolls a driver, a stdout protocol and a timeout. Other modules reach it through a test->test dependency. The integration side now also passes ScalaTest -P4, bounding its ParallelTestExecution pool to the same four interpreters the worker pool caps at, so the two concurrency bounds agree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…rify tree The pool was written for the verify harness, but nothing in it is verify-specific: it takes a worker script, a request payload it never interprets, and hands back a process-like outcome. Tests in other modules run generated operator code too, and each one that spawns Python otherwise hand-rolls a driver, a stdout protocol and a timeout of its own. So it moves to common/workflow-operator test scope, where the module holding the operator descriptors can use it directly and workflow-compiling-service reaches it through a test->test dependency. This is the layout apache#7207 upstreams, adopted here first so a later sync merges one file rather than silently ending up with a copy at each path -- git sees an add, not a rename, since the verify path does not exist upstream, and the two packages would both compile. Also brought over from that branch: the module's IntegrationTest tag, its AMBER_TEST_FILTER split with -P4, and the py_compile check's conversion from one interpreter spawn per descriptor to the pool (1119 ms -> 310 ms for 117 descriptors). Env vars renamed VERIFY_PYTHON_WORKER(S) -> TEXERA_TEST_* now that the pool is not verify's alone; StandaloneRunner's comment cited a VERIFY_STANDALONE_WORKER that never existed. Verified: WorkflowOperator's spec 3/3 with 117/117 descriptors on both the pooled and spawn paths, OperatorBehaviorSpec 6/6 on a four-operator subset, scalafmt and both modules' Test scalafix checks clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The py_compile worker's module docstring restated the motivation the PR body already carries; what code needs is the protocol and the reason compile() substitutes for py_compile without -B or a temp file. The -P4 note and the fan-out note lose their restated halves too. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Mirrors the trim pushed to apache#7207 so the five shared files stay byte-identical and a later sync merges them without conflict. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
carloea2
left a comment
There was a problem hiding this comment.
Please address the inline issue before merge.
A read on a process pipe answers neither an interrupt nor a deadline, so a worker that stayed alive without writing held its caller forever and no suite or executor timeout could release it. A thread now owns the blocking read and hands lines over a queue, so a caller waits with a deadline, and a worker that misses it is killed and discarded — the caller falls back to a one-shot subprocess, as it already does for a crash. Startup is bounded the same way; a worker that fails there is killed by the waiter, since the pool has not taken it into its set yet. PythonWorkerPoolSpec covers both deadlines against a fixture worker that goes quiet, and pins that the pool keeps serving afterwards. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ap too Reviewing the read deadline turned up two more ways a caller could wait forever, both reproduced before being fixed: A caller at the worker cap waited for a worker to be handed back, but a worker that times out or crashes is discarded — freeing a slot without returning anything — so the callers ahead could all vanish while it kept waiting. It now waits in short spells and re-examines the cap, starting a replacement itself. The request write had no deadline. A worker that stops reading its stdin blocks that write once the payload outgrows the pipe buffer, and a write is no more interruptible than a read, so it now runs on the worker's own daemon thread under the same budget. Destroying a worker also had to stop closing the buffered writer first: that flushes, into the very pipe that is full, which hung the shutdown hook and with it the JVM. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
carloea2
left a comment
There was a problem hiding this comment.
The blocking worker paths now have bounded startup, write, and response waits. Failed workers are discarded, and the regression tests cover silent and blocked workers. Looks good.
|
@aglinxinyuan May you take a look at this pr? |
There was a problem hiding this comment.
Pull request overview
This PR improves CI correctness and performance for common/workflow-operator tests that execute (or validate) generated Python by (1) routing Python-dependency tests to the amber-integration job via a local IntegrationTest tag + shared AMBER_TEST_FILTER mapping, and (2) reducing Python interpreter spawn overhead by introducing a pooled worker process for repeated py_compile-equivalent checks.
Changes:
- Added shared sbt helper
TestFilters.integrationSplitand applied it in bothamberandworkflow-operatorto select tagged integration tests viaAMBER_TEST_FILTER. - Introduced a test-scope
PythonWorkerPool(plus fixtures/spec) and updatedPythonCodeRawInvalidTextSpecto fan out descriptor checks across the pool. - Added a tagged integration-only test asserting the configured Python can import
pandasandplotly, and updated CI to runWorkflowOperator/testinamber-integration.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| project/TestFilters.scala | New shared sbt helper for mapping env var values to ScalaTest include/exclude tag args. |
| common/workflow-operator/build.sbt | Applies TestFilters.integrationSplit with the workflow-operator-specific IntegrationTest tag and -P4 for integration runs. |
| amber/build.sbt | Replaces inline AMBER_TEST_FILTER logic with TestFilters.integrationSplit. |
| .github/workflows/build.yml | Adds WorkflowOperator/test to the amber-integration job so tagged tests run where Python deps are installed. |
| common/workflow-operator/src/test/java/org/apache/texera/amber/operator/tags/IntegrationTest.java | Introduces workflow-operator-local ScalaTest tag annotation for integration-only tests. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/util/PythonCodeRawInvalidTextSpec.scala | Uses PythonWorkerPool + parallel fan-out for syntax checks; adds tagged pandas/plotly import probe. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/util/python/PythonWorkerPool.scala | New pooled worker implementation for persistent Python subprocesses keyed by script/args/env. |
| common/workflow-operator/src/test/scala/org/apache/texera/amber/util/python/PythonWorkerPoolSpec.scala | New tests covering worker hangs/timeouts, cap behavior, and recovery after discarding a worker. |
| common/workflow-operator/src/test/resources/python/py_compile_worker.py | Worker script implementing compile(source, name, "exec") over line-delimited JSON protocol. |
| common/workflow-operator/src/test/resources/python/hanging_worker.py | Fixture worker script to simulate non-responsive behaviors for pool timeout tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… string A single space separated the parts of a pool's identity, so a part that contained one — a python path with a space, a PYTHONPATH — could make two different launches produce the same key and share a worker. A case class compares field by field, and there is no separator left to collide on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Yicong-Huang
left a comment
There was a problem hiding this comment.
🟡 6 resolved · 0 open · 7 new (7 new = 1 newly introduced · 6 late catches — my own misses from earlier rounds)
Every round-4 finding is closed in the tree, not just replied to — I checked each against the file rather than the reply. What is left is two advisories about the seam itself, one stale figure in the description, and four prose items.
Design & architecture (2)
PythonWorkerPool.scala:152—envis documented as the way to carry PYTHONPATH, which the-Ithe same paragraph recommends makes CPython ignore (advisory, see inline)project/TestFilters.scala:44— an unrecognizedAMBER_TEST_FILTERvalue silently runs everything, in the one helper both jobs now share (advisory, see inline)
Conventions (1)
- Description: the "about 96 %" figure contradicts its own numbers (~89-91%); the code twin was fixed in
e56e3bc9b, and this text becomes the squash commit body (advisory)
Polish: 4 quick touch-ups (see inline comments).
Verification trace
The load-bearing question this round was whether the pooled path can disagree with the spawn it replaces on real input. It cannot. BulletChartOpDesc.scala:143 and HuggingFaceCodegenBase.scala:717 do emit non-ASCII inside generated Python, and a source carrying those characters round-trips to {"exit": 0} through the committed py_compile_worker.py under both the inherited locale and LC_ALL=C (PEP 540 turns UTF-8 mode on when LC_CTYPE is C). A mis-decode would raise on the for line in sys.stdin line, which sits outside the try at :65 — that is EOF to the pool, so it lands in the counted fallback rather than in a wrong verdict.
Two other concerns did not survive. destroy()'s catch NonFatal does not cover the InterruptedException that waitFor can throw, but every site that calls destroy() sits under an outer handler that calls it again, after process.destroy() has already sent SIGTERM; the one site with no retry is shutdown(), reached only from the JVM hook at :195. And "WorkflowOperator/test" carries no build.sbt-existence guard on the integration job's sbt line — but neither does WorkflowExecutionService/test beside it, and release/v1.2 declares the module.
The :152 finding came out of the same pass: PYTHONPATH=<dir> python3 -I -S -c "import <mod>" raises ModuleNotFoundError and sys.path carries no such entry, while dropping -I imports it and a non-PYTHON* variable survives either way.
The env parameter offered PYTHONPATH as its example, but -I implies -E, so a worker launched with the -I -S the same paragraph recommends ignores PYTHONPATH and every other PYTHON* variable. Checked: PYTHONPATH=<dir> python3 -I -S -c "import <mod>" raises ModuleNotFoundError and sys.path carries no such entry, while a non-PYTHON* variable survives either way. The parameter is fine; the example was the misleading part. TestFilters now fails on a value neither branch recognizes. It used to fall through to running everything, so a typo in either job would run the full suite in amber-integration, where the pandas probe reads its own env var, finds no match, and cancels: the non-result this split exists to remove, arriving with nothing red. One module's inline code could afford that; the helper both jobs route through cannot. Also four wordings: two Scaladoc field names that no longer matched the case class, a Javadoc clause that credited the per-case form's gain to both forms, a workflow comment saying specs where the workflow-operator side excludes a single case, and a spec comment that read as though the callers were discarded. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
All seven are addressed in
The description's 96 % is gone the same way its code twin went. I also fixed one the round missed: the description still said the executor stops anything being submitted past the cap, which you corrected in the code last round. |
|
@Yicong-Huang May you take a look at this? |
Yicong-Huang
left a comment
There was a problem hiding this comment.
🔴 7 resolved · 0 open · 6 new (6 new = 2 newly introduced · 4 late catches — my own misses from earlier rounds)
Every round-4 finding is closed in the tree, not just replied to — I checked each against the file rather than the reply, and resolved its thread. What is new is one test-fidelity defect CI cannot see, one seam question, and small prose.
Correctness (2)
PythonWorkerPoolSpec.scala:79—cancelis forced on a worker thread: a machine with no interpreter fails five cases instead of cancelling, and makes:166pass vacuously (must-fix, see inline)PythonWorkerPool.scala:406— a response that parses but carries noexitbecomes a job failure, blaming the descriptor for the worker (advisory, see inline)
Conventions (1)
- Description: say that an unrecognized
AMBER_TEST_FILTERnow fails the build — that reaches amber's build too, and the "byte-identical … under all three env values" note does not cover it (advisory)
Polish: 3 quick touch-ups (see inline comments).
Verification trace
The load-bearing question this round was whether the pool can still lose a worker slot or orphan an interpreter. It cannot. Pool.run's case e: Throwable (:226) catches the InterruptedException that NonFatal excludes. liveCount is incremented only at borrow:236 and decremented on all three exits (:240, :245, discard:292), so no path leaves a borrowed worker neither returned nor discarded. create:279-284 and awaitReady:392-397 destroy a worker that never joined all, and the script double-checked lock is @volatile-correct (:211).
The must-fix came out of the same pass. There is no JDK in my sandbox, so I parsed the ScalaTest class files rather than trust recall: TestCanceledException extends StackDepthException extends RuntimeException, so it is NonFatal and Try stores it as a Failure; and Assertions carries the wrongException key beside a TestFailedException reference, so intercept converts a non-matching throwable instead of re-throwing it.
One concern did not survive: destroy()'s catch NonFatal misses the InterruptedException waitFor can throw, but the flag is already cleared by the poll that threw, SIGTERM has been sent, and liveCount is decremented before destroy(), so no slot leaks.
…read The probe is a lazy val, and every case that needs it forced it inside Future(call)(ec), so the cancel it raises on a machine without an interpreter landed on a worker thread. TestCanceledException extends RuntimeException: Future stores it as a Failure, and intercept converts a throwable that does not match rather than re-throwing it. The five cases going through interceptBounded therefore failed where the probe's own comment promises a cancel. The case at the cap is the sharper half. Its only assertion is that every outcome is a Failure, and Try records that cancellation as exactly that, so it reported green without ever reaching the cap. Reproduced by pointing the probe at names that do not exist: 5 failed and 2 succeeded before, 8 cancel after. withFixture is the one seam every case passes through. The case that starts no interpreter at all now cancels with the rest, which costs nothing on a machine that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…er death A reply that parsed but carried no exit defaulted to 1, which is the code a failed py_compile leaves. The caller then reported the descriptor as failing to compile, with (no output) as the evidence, when nothing is wrong with the generated source. awaitReady already refuses to guess on the startup line: a line it cannot parse becomes "did not signal ready" and is quoted back. The response side coerced instead, and the class doc sells this seam as generic. It now leaves as a WorkerDiedException, so the pool discards the worker and the caller's existing fallback to a spawn covers it, which is the property that fallback is there for. The fixture gains a request answered without the field, travelling as a request like its other per-job mode rather than as a launch flag, and the spec a case on it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
An unrecognized value fails at project load, which makes the message the first and only thing a developer sees. It named the variable and the value it had but not what to put there, sending the reader to find the file instead. Also two wordings in the module's build.sbt. A missing comma left "excludes it and amber-integration" reading as one compound object until the verb three words later forced a re-parse. And an "either/the other" had no resolvable pair: the preceding sentence names a variable and a value, while the two sites that have to stay in step are this file and the spec, so it now names both. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Yicong-Huang
left a comment
There was a problem hiding this comment.
🔴 6 resolved · 0 open · 4 new (4 new = 1 newly introduced · 3 late catches — my own misses from earlier rounds)
Every round-4 finding is closed in the tree, not just replied to — I checked each against the file rather than the reply, and all 32 threads are resolved with none reopened.
Correctness (2)
py_compile_worker.py:49—compile()inheritsfrom __future__ import annotations, so the pooled check accepts sourcespy_compilerejects (must-fix, see inline)PythonWorkerPoolSpec.scala:252— the new case is the suite's only unbounded wait, in the shared sub-pool, so a slot leak wedges the build (must-fix, see inline)
Polish: 2 quick touch-ups (see inline comments).
Verification trace
The load-bearing claim this round was the pooling half's own safety argument: that the pooled check accepts exactly what the python -I -S -B -m py_compile spawn accepted. It does not, and I ran the commands rather than reading the docs. py_compile compiles with dont_inherit=True; the worker's compile(source, name, "exec") defaults to dont_inherit=False, inheriting the from __future__ import annotations at py_compile_worker.py:37. On def f(x: (yield 1)): pass the spawn exits 1, the worker accepts, and dont_inherit=True rejects again.
The rest of the pool held up. Round 4's two fixes are real: withFixture (:90-93) forces the interpreter probe onto the test thread, and Worker.run (:415) refuses to guess a missing exit. Borrow/return accounting stays balanced — liveCount moves only at :237 and the three exits :241, :245, :293.
One concern did not survive. A malformed request makes py_compile_worker answer exit 1 and blame the descriptor, the same wrong-party shape as round 4's missing-exit finding — but it is unreachable: objectMapper.writeValueAsString (:441) is the only writer and always emits valid JSON.
The pooled check inherited this module's own `from __future__ import annotations`, because `compile` defaults to `dont_inherit=False` while `py_compile` passes True. That made the two disagree on a real source: on CPython 3.12 a walrus inside an annotation compiles under the spawn and raises here. None of the 117 generated descriptors hits that shape, so the sweep was green either way. What was wrong is the check's own fidelity to the spawn it replaces. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The missing-exit-code case was the one wait here with no deadline, and it shares a sub-pool with the cap and interrupt cases. `borrow`'s at-cap path rechecks on a tailrec loop that has no deadline of its own, so a leaked slot, which is the thing the interrupt case exists to catch, would leave this case spinning on the test thread and wedge the build instead of failing it. The case above it gets away with a bare intercept because its unique `pythonExe` gives it a fresh sub-pool that never reaches the cap. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The pool's scaladoc offered `--serve` as a launch-arg example, which no worker script in the tree accepts. The fixture's real flags are `--deaf`, `--hang-before-ready` and `--babble`, so a reader went looking for an option that is not there. The module's build.sbt named operator-requirements.txt as what amber-integration installs, but the tagged test also needs pandas, which comes from requirements.txt. The job installs both, so naming one left the other looking trimmable from that job. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Resolved the problems. |
Yicong-Huang
left a comment
There was a problem hiding this comment.
🟢 4 resolved · 0 open · 2 new (2 new = 0 newly introduced · 2 late catches — my own misses from earlier rounds)
All four round-5 findings are closed in the tree, checked against the files rather than the replies, and this round's three commits are exactly those four fixes. All 36 threads are resolved, none reopened.
Polish: 2 quick touch-ups (see inline comments).
Verification trace
The load-bearing claim this round was that dont_inherit=True makes the pooled check accept exactly what the spawn accepted. Confirmed at the source rather than the docs: py_compile reaches compile through SourceLoader.source_to_code, which passes dont_inherit=True and optimize=_optimize, so the worker now matches the spawn on both flags (optimize defaults to -1 on both sides). You were right about the direction — on 3.9.6 the toggle changes only the yield case, not the walrus one — and the flag is correct either way.
The bound fix holds too. :253 was the last wait in the suite outside interceptBounded; the only remaining bare intercept (:209) has a unique pythonExe, so its Key differs and its sub-pool never reaches the cap. I re-walked the borrow/return accounting once more while I was there: liveCount moves only at :237 and the three decrements :241, :245, :293, and Pool.run's catch Throwable funnels every exit — including the interrupt NonFatal excludes — into discard, so even a worker that dies while parked in idle is accounted on its next borrow.
One divergence I weighed and did not raise: py_compile hands compile the raw bytes, so a source carrying a PEP 263 encoding cookie would pass the spawn and raise encoding declaration in Unicode string here. No generated template has one, and it would fail loud rather than wave anything through, so it cannot weaken the check.
…r/util/python/PythonWorkerPoolSpec.scala Co-authored-by: Yicong Huang <[email protected]> Signed-off-by: Kary Zheng <[email protected]>
…r/util/python/PythonWorkerPoolSpec.scala Co-authored-by: Yicong Huang <[email protected]> Signed-off-by: Kary Zheng <[email protected]>
|
Resolved the comments. @aglinxinyuan May you take a look at it? Thank you! |
) ### What changes were proposed in this PR? Remove unused imports, bindings, helpers and fields, and settings that repeat a default or another entry, from the Amber Python runtime, the Python test resources of the workflow compiler and operators, the `bin/` licensing, local-dev and observability scripts, repository configuration, and three GitHub workflows (**+102/-172 lines**). There is no behavior change. - **Amber Python runtime:** `StatisticsManager` uses `defaultdict` instead of the deprecated `typing.DefaultDict`, and `BroadcastPartitioner` builds its batch with `[]`. `LargeBinaryOutputStream` raises and documents `OSError` (which `IOError` aliases), wraps its best-effort cleanup delete in `contextlib.suppress`, and drops the `pass` after `flush`'s docstring. - **Operator verification test resources:** `py_op_driver.py` drops ten `pytexera` imports and `RAW_TYPE_MAPPING` that it never reads. User code runs in its own namespace seeded by `from pytexera import *`, so the "used dynamically" note on those imports did not hold. `compare.py` drops the uncalled `_string_columns` helper and two dict copies of `double_kinds_a`/`double_kinds_e`, and `hf_parse_probe.py` drops unused `io` and `re` imports. Quoted annotations, `open(..., "r")`, `startswith` plus a slice, and a placeholder-free f-string take their plain forms here and in `standalone_worker.py`, `py_compile_worker.py` and `hf_binary_value_probe.py`. - **`bin/` scripts:** the licensing tools use a tuple `startswith`, read the one regex group they need instead of unpacking all four, print plain strings where f-strings had no placeholders, return a `bool` expression directly, drop annotation quotes under `from __future__ import annotations`, use `removesuffix`, and name unused loop values `_`. Two licensing tests drop `# noqa: E402` comments that suppress nothing under Ruff, and `test_local_dev_tui.py` drops the never-passed `version` parameter of `_seed_jvm_layout` together with the docstring sentence about a jar it never wrote. `bin/observability/smoke_test.py` stops returning an unread status from `_post`, builds the trace id from one `uuid4().hex` (the first 32 hex digits of two concatenated ones were always the first), and drops a `leaked = False` that both branches of the following `try` overwrite. - **Repository configuration:** `amber/pyproject.toml` drops `line-length = 88` and `max-complexity = 10`, which are Ruff's defaults (and `C901` is not selected). `.dockerignore` drops a root `user-resources/` entry that its first rule, `**/user-resources/`, already covers. `bin/fix-format.sh` drops the `""` case that `TARGET="${1:-all}"` makes unreachable, and `bin/frontend-proto-gen.sh` drops a `--proto_path` that repeats its `-I`. `bin/k8s/templates/aws/.gitkeep` goes, since the folder holds `s3-credentials-secret.yaml`. `bin/y-websocket-server/package.json` drops npm-init's `main` and placeholder `test` script (the image runs `npx y-websocket`), and a `bin/observability/docker-compose.yml` comment stops pointing at a `start_app.sh` that the repository does not have. - **GitHub workflows:** `comment-commands.yml` drops `github.event_name == 'issue_comment' && github.event.action == 'created'` from three job conditions, because the workflow only runs on `issue_comment: [created]`. `pr-assignment.yml` drops a `|| ''` that follows a `typeof ... === 'string'` guard. `benchmarks-pr-comment.yml` stops storing per-benchmark commit and date, a sample count and delta labels that nothing reads, takes each row's status from the deltas it already computed instead of a second `deltaInfo` pass, reuses each metric's 7-day delta, and builds the PR-only CSV table only when there is no comparison to show. | Event | PR / Commit | | --- | --- | | Introduced by | Amber Python runtime: apache#1891 (2023-05-01), apache#3262 (2025-02-18), apache#4100 (2025-12-15), apache#4707 (2026-05-03), apache#5249 (2026-06-06), apache#8260 (2026-11-18); test resources: apache#7207 (2026-08-14), apache#8617 (2026-10-15), apache#9306 (2026-11-10), apache#8357 (2026-11-17), apache#8358 (2026-11-18), apache#8359 (2026-11-19); `bin/` scripts: apache#4387 (2026-04-29), apache#4668 (2026-05-02), apache#4693 (2026-05-02), apache#4711 (2026-05-03), apache#5057 (2026-05-15), apache#5417 (2026-06-10), apache#5961 (2026-06-28), apache#5377 (2026-10-28); configuration: apache#3019 (2024-11-20), apache#3335 (2025-03-23), apache#3441 (2025-05-19), apache#3890 (2025-10-14), apache#4005 (2025-10-29), apache#4105 (2025-12-05), apache#5757 (2026-06-24); workflows: apache#4885 (2026-05-03), apache#4986 (2026-05-08), apache#5148 (2026-05-22), apache#5557 (2026-06-11), apache#5639 (2026-06-12) | | Usage removed by | `issue_comment` checks: apache#4899 (2026-05-04, `ci: drop the triage label, use is:open no:assignee filter`) moved `/take` out of `issue-triage.yml`, which also ran on `issues` events, into a workflow that only runs on created comments, and apache#4986 and apache#5148 copied the checks into two new jobs; `aws/.gitkeep`: apache#5932 (2026-07-01, `feat(k8s): make app-tier object storage configurable via storage.s3`) added the folder's first template; PR-only CSV table: apache#5639 (2026-06-12, `ci: compare benchmark PRs with main`) shows it only when there is no comparison; everything else: unused or redundant since introduction | As of 2026-11-23, the unread test-resource code is under a week old, the `.gitkeep` placeholder and the unread benchmark fields have been redundant for about 5 months, the `issue_comment` checks for over 6 months, and the duplicate `.dockerignore` entry and `--proto_path` for 20 and 24 months. ### Any related issues, documentation, discussions? Closes apache#9676. ### How was this PR tested? Ran on `525f8ce3fb` and on `main` at `89a492f97e` (Windows 11, Python 3.12 with CI's pinned `ruff` 0.14.7, `pytest` 9.0.3 and `textual` 8.2.8, JDK 17): ```bash cd amber ruff check src/main/python src/test/python ruff format --check src/main/python src/test/python pytest -m "not integration" cd .. ruff check $(git diff --name-only origin/main -- '*.py' ':!amber/') python -m pytest bin/ -v --tb=short sbt "WorkflowCompilingService/testOnly org.apache.texera.amber.translator.verify.ComparatorSpec org.apache.texera.amber.translator.verify.HarnessSpec org.apache.texera.amber.translator.verify.PyOpExecHarnessSpec org.apache.texera.amber.translator.verify.VisualizationJsonComparatorSpec" sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.huggingFace.codegen.HuggingFaceBinaryValueBehaviorSpec org.apache.texera.amber.operator.huggingFace.codegen.HuggingFaceParseBehaviorSpec org.apache.texera.amber.util.PythonCodeRawInvalidTextSpec" ``` - Ruff: passed on `amber/` (218 files already formatted) and on the 14 changed Python files outside `amber/`. - `pytest -m "not integration"` in `amber/` (JUnit XML): each of the 1,524 tests has the same outcome as on `main`: 1,496 passed, 10 skipped, and the same 18 platform-dependent tests (Iceberg catalog on PostgreSQL and `s3fs`, time zones, object reprs) fail on this Windows machine on both. - `python -m pytest bin/` (JUnit XML): each of the 196 tests has the same outcome as on `main`: 186 passed, and nine `bin/mounter` tests plus `test_stamp_dir_for_matches_shell_sha1`, which assume POSIX paths and shells, fail on Windows on both. - sbt (JUnit XML, `UDF_PYTHON_PATH` set to Python 3.12 because Windows has no `python3`): these seven suites load the edited test resources. `WorkflowCompilingService` passed 52 of 52 in 4 suites and `WorkflowOperator` 11 of 11 in 3 suites, with 0 canceled, the same as on `main`. - Licensing scripts: `concat_license_binary.py` writes byte-identical combined licenses for the Python and frontend images, and `check_binary_deps.py jar` prints byte-identical reports and exit codes for a synthetic lib folder with missing, extra and version-mismatched jars, with and without `--ignore-transitive-version`. - Workflows: the three edited workflows run only from the default branch (`issue_comment`, `pull_request_target` and `workflow_run`), so this PR's CI cannot run them. Each edited `github-script` body ran before and after under Node with recording stubs for `github`, `core`, `fs` and `fetch`, over 496 fixtures (missing or malformed CSV and baseline data, failed API calls, body edits with and without closing references). Every API call, comment body and log line is identical, and a one-line change to each script does show up in its traces. The `comment-commands.yml` conditions differ from `main` only by the two removed checks. - `bash -n` passes on `bin/fix-format.sh` and `bin/frontend-proto-gen.sh`, and the edited YAML, TOML and JSON files parse. - After review, `f84888ca6c` changes only three docstrings in `large_binary_output_stream.py` and inlines one local in `py_op_driver.py`. On it, Ruff passes as above, each of the 1,524 `amber` tests again has the same outcome as on `main`, the four `WorkflowCompilingService` suites pass 52 of 52, and `_jsonify` returns the same strings as on `525f8ce3fb` for seven `BINARY` inputs, with and without the pickle marker. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)
### What changes were proposed in this PR? Remove unused code from the Scala sources and tests of the Amber engine and web server, `workflow-core`, `workflow-operator`, `observability` and the notebook-migration service, and narrow the database reads of the account, notification, dashboard-search, Hub and Jupyter-registration lookups to the columns and rows they use (**+285/-316 lines**). Production behavior does not change. Two CSV tests that are named for multi-line data now read the multi-line file. **Unused code** - **Unused bindings:** pattern, `catch` and callback bindings that nothing reads become `_` in `ClusterListener`, `DeadLetterMonitorActor`, `Utils`, `SequentialRecordStorage`, the argument parsers of `ComputingUnitMaster` and `ComputingUnitWorker`, `WebsocketInput`, `WorkflowWebsocketResource`, `AiAssistantManager`, `ExecFactory`, `VirtualIdentityUtils`, `URLFetchUtil` and `HtmlVizOpDesc`. The two argument parsers end in `case _`, since `case Nil` already takes the empty list. - **`S3StorageClient.uploadObject`:** - `readChunk` uses a plain `while` loop instead of assigning inside the loop condition. - The parts upload in a `while` loop that adds each `CompletedPart` to the Java list the SDK takes. Before, an `Iterator` of `(partNumber, size)` tuples became a Scala `List` and then went back through `.asJava`. - Each part is copied out of the reused buffer once and streamed from that copy. `buffer.take` and `RequestBody.fromBytes`, which calls `Arrays.copyOf` itself, copied it twice. The content provider gives each SDK attempt a fresh stream over the same bytes. - Part numbers, upload order, part sizes, the `application/octet-stream` content type and the read of the next chunk after each upload are unchanged. - **`SQLSourceOpExec.fetchBatchByBoundary`:** returns the result of the type `match` as a `val` instead of overwriting a `var` that starts as `null`. - **Worker statistics:** `StatisticsManager.getStatistics` drops the executor parameter it has not read since its sink-operator check went away. `DataProcessor` and both statistics specs stop passing an executor to it. - **Telemetry:** `WorkflowMetricsRecorder` drops a `LazyLogging` it never logs with, and `WorkflowMetrics` drops the `Cancelled` outcome and the `Unknown` workflow kind that nothing records. - **Scan sources:** `SkippedRowReporter` drops its uncalled `count`, and `ArrowSourceOpExec` drops a batch counter it only increments. - **Arrow Flight benchmark:** sorts each run's latencies once, instead of once per percentile. - **Test helpers:** - `DPThreadSpec.awaitCond` drops its unused default budget, and the spec's callbacks name their unused argument `_`. - `ExternalAuthProvisionerSpec`'s `seedUser` and `seedUserWithEmail` drop the `avatar` parameter that no test passes. - `DictionaryMatcherOpExecSpec.withExecutor`, `HashJoinOpSpec.tuple` and the tuple builders of `IntervalOpExecSpec` drop defaults that every caller overrides. - `PythonWorkerPool` starts its stdout and stderr reader threads without keeping the references it never reads. - **Test fixtures:** - `TestOperators` drops `asterixDBSourceOpDesc`, a descriptor for the AsterixDB server at `ipubmed4.ics.uci.edu` that only its own `TestOperatorsSpec` case still built. It also drops the `multiLine` parameter that `getCsvScanOpDesc` never read. - `headerlessSmallMultiLineDataCsvScanOpDesc` reads `country_sales_headerless_small_multi_line.csv` again, so `DataProcessingSpec`'s headerless multi-line case runs on multi-line data. - The matching `CSVScanSourceOpDescSpec` case now reads that file too, and checks the scanned rows: 100 rows of 14 fields, a quoted value with commas, and two values with line breaks. **Database reads** - **Account, login and notification queries:** - `AuthResource`'s login query selects the user columns and the password hash, instead of every column of the joined `auth_provider` and `user` rows. `ExternalAuthProvisioner`'s lookup selects only the user columns. - The admin-bootstrap and add-email checks in `AuthResource`, the duplicate-email check in `AdminUserResource` and `UserResource.isJoiningReasonRequired` read one column, or use `selectOne`, instead of a full user row. - `GmailResource` reads only the requester's name and the admins' email addresses, compiles its email regex once, and passes the subject and the domain-suffixed content to `createMimeMessage` instead of copying the `EmailMessage`. - **Dashboard search:** - `searchAllResources` builds its results in one pass over the first `count` rows. Before, it built a list of entries, filtered out the omitted ones, and scanned the list again for `hasMismatch`. - `getOrderFields` drops the `case None` branch and the private `getColumnField` with its `case _ => null`, which its regex makes unreachable, and compiles the regex once. - `WorkflowSearchQueryBuilder` builds its access condition as a `val` instead of overwriting a `DSL.trueCondition()` initializer. `VersionedResourceSearchQueryBuilder` drops a `getGroupByFields` override that returns the base default. - `VersionedResourceTables.hydrate` stops pairing each entry with a resource ID that every caller discarded, drops `idOf`, and reads the owner email from the record without building a `User` POJO. - **Hub (`HubResource`):** - The versioned-resource lookup selects the resource columns, the owner email and the privilege that `hydrate` reads, instead of every joined column. `VersionedResourceTables.hydrationFields` defines that list next to `hydrate`, because a query that left a column out would get a `null` email or privilege without an error. - `isLikedHelper` collects the liked IDs with `fetchSet`. Like/unlike and clone check for an existing row with `fetchExists` instead of fetching it, and like/unlike no longer goes through the batch helper. - `getCounts` reuses each entity type's request group, and drops the zero entries it added for missing view counts, since the lookup already defaults to 0. - **Notebook migration:** `NotebookMigrationResource` stops selecting the notebook ID it never reads, and drops `JSONB` casts that its typed fields make redundant. `JupyterEndpointResolver` selects the two registration URLs instead of a full `user_jupyter` row, and `JupyterProvisioner` derives a healthy registration's token once instead of twice. **Tests for rewritten paths no test reached** - `DatasetSearchQueryBuilderSpec` runs a dataset search over a dataset that lakeFS rejects, and expects it left out with `hasMismatch` set. - `HubResourceSpec` fetches such a dataset by ID and expects it dropped. - `AdminUserResourceSpec` moves a user to an address no other account uses. | Event | PR / Commit | | --- | --- | | Introduced by | Amber engine and web server: apache#945 (2021-01-05), apache#1101 (2021-05-03), apache#1387 (2022-02-10), apache#1381 (2022-05-13), apache#1671 (2022-11-07), apache#1677 (2022-11-07), apache#2060 (2023-07-14), apache#2529 (2024-03-29), apache#2570 (2024-04-07), apache#2808 (2024-09-02); account and notification queries: apache#3080 (2024-11-19), apache#3393 (2025-04-29), apache#3440 (2025-06-08), apache#4185 (2026-02-16), apache#7055 (2026-08-10), apache#7758 (2026-08-21), apache#7639 (2026-08-30), apache#7978 (2026-08-31); dashboard search and Hub: apache#2358 (2024-02-23), apache#2838 (2024-09-25), apache#3252 (2025-02-09), apache#3446 (2025-05-26), apache#3442 (2025-06-28), apache#3519 (2025-07-09), apache#7928 (2026-08-26), apache#7930 (2026-09-01), apache#8890 (2026-10-27); `workflow-core`: apache#2271 (2024-01-18), apache#3183 (2024-12-31), apache#4067 (2025-11-25); `workflow-operator`: apache#1013 (2021-02-11), apache#1866 (2023-03-23), apache#3139 (2024-12-06), apache#3186 (2024-12-31), apache#6947 (2026-10-02); `observability`: apache#5376 (2026-10-27); notebook migration: apache#5258 (2026-06-24), apache#8032 (2026-09-03); tests and benchmark: apache#1044 (2021-02-25), apache#1083 (2021-04-25), apache#1227 (2021-07-25), apache#2254 (2023-12-13), apache#2302 (2024-02-05), apache#3425 (2025-05-26), apache#4836 (2026-05-03), apache#5439 (2026-06-06), apache#5557 (2026-06-11), apache#6077 (2026-07-03), apache#7116 (2026-07-31), apache#7207 (2026-08-14), apache#7870 (2026-08-23), apache#7875 (2026-08-31), apache#9534 (2026-11-19), apache#9518 (2026-11-21) | | Usage removed by | AsterixDB fixture: apache#1118 (2021-05-11, `Disable dependent tests with AsterixDB`) commented out its only test use, which apache#3294 (2025-03-04) deleted; multi-line fixture: apache#3111 (2024-11-26, `Update amber to depend on sub projects`) pointed `headerlessSmallMultiLineDataCsvScanOpDesc` at the single-line file; `awaitCond`'s default budget: apache#9534 (2026-11-19, `test(amber): share engine and service test fixtures`) routed its last callers through a helper that always passes one; `getStatistics`' executor parameter: apache#3312 (2025-03-12, `Remove Sink Operator in the Backend`) dropped its only read, the sink-operator check; everything else: unused or redundant since introduction | As of 2026-11-24, the AsterixDB fixture has had no test use for over 5 years, and the headerless multi-line CSV fixture has read single-line data for about 12 months. ### Any related issues, documentation, discussions? Closes apache#9680. ### How was this PR tested? The first commit (`cb95cd29b7`) ran on its base, `main` at `de3f021dec`. The second commit ran on this branch before it (`2e980903c8`, after merging `main`) and after it, the third likewise on `dee7711a88`, the fourth on `3870a2da97`, and the fifth on `4c244837bf`. Both used Windows 11, JDK 17, `UDF_PYTHON_PATH` set to Python 3.12, and Docker for the RustFS container that `S3StorageClientSpec` starts. The e2e case uses the Hadoop Iceberg catalog because no REST catalog runs on this machine: ```bash WUNUSED='set ThisBuild / scalacOptions += "-Wunused:patvars,params,privates"' sbt "$WUNUSED" "WorkflowCore/testOnly org.apache.texera.amber.core.executor.CoreExecutorReflectionSpec org.apache.texera.amber.util.VirtualIdentityUtilsSpec org.apache.texera.service.util.S3StorageClientSpec" sbt "$WUNUSED" "WorkflowOperator/testOnly org.apache.texera.amber.operator.TestOperatorsSpec org.apache.texera.amber.operator.dictionary.DictionaryMatcherOpExecSpec org.apache.texera.amber.operator.hashJoin.HashJoinOpSpec org.apache.texera.amber.operator.intervalJoin.IntervalOpExecSpec org.apache.texera.amber.operator.source.fetcher.URLFetchUtilSpec org.apache.texera.amber.operator.source.fetcher.URLFetcherOpExecSpec org.apache.texera.amber.operator.source.scan.csv.CSVScanSourceOpDescSpec org.apache.texera.amber.operator.source.scan.csv.CSVScanSourceOpExecSpec org.apache.texera.amber.operator.source.sql.* org.apache.texera.amber.operator.visualization.htmlviz.HtmlVizOpDescSpec org.apache.texera.amber.util.python.PythonWorkerPoolSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.amber.clustering.ClusterListenerSpec org.apache.texera.amber.engine.architecture.messaginglayer.DeadLetterMonitorActorSpec org.apache.texera.amber.engine.architecture.worker.DPThreadSpec org.apache.texera.amber.engine.common.UtilsSpec org.apache.texera.amber.engine.common.storage.SequentialRecordStorageSpec org.apache.texera.web.ComputingUnitMasterSpec org.apache.texera.web.ComputingUnitWorkerSpec org.apache.texera.web.WebsocketInputSpec org.apache.texera.web.resource.WorkflowWebsocketResourceSpec org.apache.texera.web.resource.aiassistant.AiAssistantManagerSpec org.apache.texera.web.resource.auth.ExternalAuthProvisionerSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.web.TexeraWebApplicationSpec org.apache.texera.web.resource.GmailResourceSpec org.apache.texera.web.resource.auth.AuthResourceSpec org.apache.texera.web.resource.auth.ExternalAuthProvisionerSpec org.apache.texera.web.resource.auth.OrcidAuthResourceSpec org.apache.texera.web.resource.dashboard.DashboardResourceSpec org.apache.texera.web.resource.dashboard.DatasetSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.ModelSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.UnifiedResourceSchemaSpec org.apache.texera.web.resource.dashboard.VersionedResourceTablesSpec org.apache.texera.web.resource.dashboard.WorkflowSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.admin.user.AdminUserResourceSpec org.apache.texera.web.resource.dashboard.file.DatasetResourceSpec org.apache.texera.web.resource.dashboard.file.WorkflowResourceSpec org.apache.texera.web.resource.dashboard.hub.EntityTablesSpec org.apache.texera.web.resource.dashboard.hub.HubEntityModelSpec org.apache.texera.web.resource.dashboard.hub.HubResourceSpec org.apache.texera.web.resource.dashboard.user.UserResourceSpec org.apache.texera.web.resource.dashboard.user.workflow.WorkflowPublishSpec org.apache.texera.web.service.WorkflowEmailNotifierSpec" STORAGE_ICEBERG_CATALOG_TYPE=hadoop sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.e2e.DataProcessingSpec -- -z headerlessMultiLineDataCsv" sbt "$WUNUSED" Observability/test NotebookMigrationService/test "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.scan.*" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.coordinator.promisehandlers.ConsoleMessageHandlerSpec org.apache.texera.amber.engine.architecture.messaginglayer.WorkerTimerServiceSpec org.apache.texera.amber.engine.architecture.worker.DPThreadSpec org.apache.texera.amber.engine.architecture.worker.DataProcessorRPCHandlerInitializerSpec org.apache.texera.amber.engine.architecture.worker.DataProcessorSpec org.apache.texera.amber.engine.architecture.worker.WorkerSpec org.apache.texera.amber.engine.architecture.worker.WorkflowWorkerSpec org.apache.texera.amber.engine.architecture.worker.managers.StatisticsManagerSpec org.apache.texera.amber.engine.architecture.worker.managers.WorkerManagersSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.EndChannelHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.EndHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.FinalizeCheckpointHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.StartChannelHandlerSpec org.apache.texera.amber.engine.architecture.worker.promisehandlers.StartHandlerSpec org.apache.texera.amber.engine.common.UtilsSpec org.apache.texera.amber.engine.faulttolerance.CheckpointSpec org.apache.texera.web.observability.WorkflowMetricsRecorderSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.web.resource.dashboard.DatasetSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.DashboardResourceSpec org.apache.texera.web.resource.dashboard.admin.user.AdminUserResourceSpec org.apache.texera.web.resource.dashboard.hub.HubResourceSpec org.apache.texera.web.ComputingUnitMasterSpec org.apache.texera.web.ComputingUnitWorkerSpec" sbt "$WUNUSED" "WorkflowExecutionService/testOnly org.apache.texera.web.resource.dashboard.DatasetSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.ModelSearchQueryBuilderSpec org.apache.texera.web.resource.dashboard.VersionedResourceTablesSpec org.apache.texera.web.resource.dashboard.DashboardResourceSpec org.apache.texera.web.resource.dashboard.hub.EntityTablesSpec org.apache.texera.web.resource.dashboard.hub.HubEntityModelSpec org.apache.texera.web.resource.dashboard.hub.HubResourceSpec" sbt WorkflowCore/scalafmtCheckAll WorkflowOperator/scalafmtCheckAll WorkflowExecutionService/scalafmtCheckAll Observability/scalafmtCheckAll NotebookMigrationService/scalafmtCheckAll "WorkflowCore/scalafixAll --check" "WorkflowOperator/scalafixAll --check" "WorkflowExecutionService/scalafixAll --check" "Observability/scalafixAll --check" "NotebookMigrationService/scalafixAll --check" ``` - JUnit XML, compared per test: - First commit: the first three test commands and the e2e case run 36 suites that load every file the commit changes, and `SQLSourceOpExecSpec` calls `fetchBatchByBoundary` for each numeric type through a mocked JDBC result. All 554 tests pass on `main` and all 553 with the commit. Each test has the same outcome as on `main`; the missing one is the removed `asterixDBSourceOpDesc` case. - Second commit: the fourth command runs the 20 suites that load the account, notification, dashboard-search and Hub code, against an embedded PostgreSQL. All 525 tests pass before and after the commit, each with the same outcome. - Third commit: the sixth and seventh test commands run every `Observability`, `NotebookMigrationService` and scan-source suite, plus the worker, statistics, checkpoint and telemetry suites that load the changed classes. Before and after it, 581 of the 595 tests in these 48 suites pass, each with the same outcome. The other 14 fail on both sides on this machine: 13 `ParquetScanSourceOpDescSpec` cases need Hadoop's Windows binaries, and one `FileScanSourceOpDescSpec` case hits a Windows temp-file lock. - Fourth commit: the eighth test command runs the six suites it touches. All 179 tests pass, the three new ones included. - Fifth commit: the ninth test command runs the seven suites that load `VersionedResourceTables` or the Hub query. All 182 tests pass. - On the second commit's head, all 55 suites of the first two rounds pass, the e2e case included: 1,059 tests. - `S3StorageClientSpec` runs its 34 cases against RustFS 1.0.0 in Testcontainers on both sides. They include a 6 MiB upload (a 5 MiB part and a 1 MiB tail) that downloads back byte for byte, an empty upload, and the abort when the input stream fails after the first part. - With the fixture pointed back at `country_sales_headerless_small.csv`, the strengthened `CSVScanSourceOpDescSpec` case fails: row 8 reads `Republic of the Congo` instead of `Republic,of,the,Congo`. The `DataProcessingSpec` case runs the multi-line file through the engine and gets the same 100 rows that the single-line file gives on `main`. - scalafmt and scalafix pass on all five touched modules. - With `-Wunused:patvars,params,privates`, the compiler reports 26 unused names in the files of the first commit on `main`. That commit removes 24 of them. The other two are `config` and `cr`, which the `@OnOpen` and `@OnClose` methods of `WorkflowWebsocketResource` need for the WebSocket API's signatures; they are reported on both. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)
What changes were proposed in this PR?
The
amberjob runs theWorkflowOperatortest suite and installs no Python packages. A test that executes an operator's generated template, rather than onlypy_compile-ing it, therefore fails its dependency probe and cancels — and a cancellation is neither a pass nor a failure, so the suite still reports "All tests passed" and the gap leaves no trace in the build.This gives
WorkflowOperatorthe splitamberalready has:IntegrationTestundercommon/workflow-operator/src/test. amber's cannot be reused: it lives inamber/src/test/integration, and amber depends on this module rather than the reverse.common/workflow-operator/build.sbtreads the sameAMBER_TEST_FILTER. Theamberjob already sets it on the step that invokesWorkflowOperator/jacoco, so no workflow change is needed for the exclusion to take effect."WorkflowOperator/test"added toamber-integration, which already runsintegration-onlywithamber/requirements.txtandamber/operator-requirements.txtinstalled (pandas 2.2.3, plotly 5.24.1).project/TestFilters.scala, beside the build's other shared helpers (AddMetaInfLicenseFiles.scala,JdkOptions.scala); each module passes its own env var and tag, the two a caller has to match to the workflow and to the annotation. One behavior changes, and amber inherits it: a value that is neither of the two now fails at project load, where the inline code fell through to running everything. Nothing sets a third value, so what this catches is a typo that would otherwise leave a job running the whole suite while reporting the subset it asked for.PythonCodeRawInvalidTextSpecgains a tagged case asserting that pandas and plotly import in the interpreter it already resolves:py_compileonly parses the emitted code, while running it needs the packages it imports. Being tagged, it also exercises the routing, and it turns a missing install inamber-integrationinto a failure rather than the silent cancellation above. Elsewhere a bare interpreter is a local-setup fact, so it cancels instead.The second half addresses the scaling problem in the same issue: testing operators one at a time does not scale when each one costs a spawn.
py_compilecheck spawnedpython -I -S -B -m py_compileonce perPythonOperatorDescriptor, 117 of them serially, where the interpreter boot is the entire cost and the compile is under a millisecond. It now goes throughPythonWorkerPool: a worker launched once with the same-I -Sisolation, serving many sources over a line-delimited JSON protocol. What the check accepts is unchanged —compile(source, path, "exec")is whatpy_compiledoes before writing a.pyc, and raises the same SyntaxError — and any worker the pool cannot give out or keep falls back to the spawn, so behavior is never worse than before: one that would not start, would not report ready, or died mid-job all leave through the same exception, and the check counts the descriptors that took the spawn into its summary so a run the pool served none of does not read as a green pooled run.TEXERA_TEST_PYTHON_WORKER=0selects the old path outright.test->testdependency.Any related issues, documentation, discussions?
Fixes #7186. Found while reviewing #7149, whose runtime test is the case cancelling today; tagging it is a one-line follow-up once this is in, and converting its hand-rolled driver to the pool is the natural second one. The pooled-worker design, and the measurements behind those figures, are in #6975.
How was this PR tested?
amberis unchanged by the extraction:show WorkflowExecutionService/Test/testOptionsunder all three env values gives arguments byte-identical to its previous inline code —-l <tag>,-n <tag>, nothing when unset.WorkflowOperatorwas checked the same way and yields its own tag in those positions.WorkflowOperator/testOnly *PythonCodeRawInvalidTextSpec: passes underintegration-only(1 test selected); is excluded underskip-integrationwhile the spec's two existing tests still run; and, pointed at a bare interpreter, fails underintegration-onlyand cancels with no filter set.TEXERA_TEST_PYTHON_WORKER=0flips between them. Timed with-oD: 1119 ms spawning, 310 ms pooled.ok=0/117and fails the test, so it still detects what it is there to detect.PythonWorkerPoolSpeckeeps a case on each: an interrupted caller used to leave a worker neither returned nor discarded, and the case that refills every slot and then asks for that many jobs again spins at the cap until its bound without the fix; a first line that is not the protocol used to raiseJsonParseExceptionpast the caller's fallback, and the fixture now has a mode that writes one; an interpreter that cannot be started arrives as the pool's own exception rather thanProcessBuilder's.WorkflowOperator/testunderskip-integration: 286 suites, 2163 tests, none failed.sbt scalafmtCheckAllis clean, andWorkflowOperator'sCompileandTestscalafix checks pass.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)