aglinxinyuan opened a new pull request, #6530:
URL: https://github.com/apache/texera/pull/6530

   ### What changes were proposed in this PR?
   
   Adds a regression test, 
`test_two_main_loops_load_distinct_operator_classes`, in 
`amber/src/test/python/core/runnables/test_main_loop.py`. No source changes.
   
   It creates two `MainLoop`s in the same process, initializes the first with 
`EchoOperator` and deliberately leaves that worker "unfinished" (its temp fs is 
never closed, like a crashed/never-completed worker), then initializes the 
second with `CountBatchOperator` and asserts the second executor is exactly 
`CountBatchOperator`.
   
   This guards `ExecutorManager`'s process-globally-unique module naming end to 
end. Executor modules were historically named `udf-v<per-instance-counter>`, so 
every loop's first executor was `udf-v1` in the process-wide `sys.modules`; a 
loop whose worker never completed left a stale `udf-v1.py` on `sys.path`, and 
the next loop re-resolved `udf-v1` to that older file — silently running the 
wrong operator. That collision was fixed by switching to a process-wide 
counter, but the suite had no end-to-end test spanning two `MainLoop`s, so a 
regression back to a per-instance counter would still pass CI. This closes that 
gap.
   
   The test uses **no** monkeypatch of `gen_module_file_name` — module names 
must be process-globally unique on their own.
   
   ### Any related issues, documentation, discussions?
   
   Regression coverage for the module-name collision fixed in #4717 (issue 
#4705).
   
   ### How was this PR tested?
   
   `cd amber && python -m pytest 
src/test/python/core/runnables/test_main_loop.py` — the new test passes on 
`main`. `ruff check` and `ruff format --check` are clean.
   
   Confirmed it is a genuine guard, not a tautology: on the pre-fix code 
(per-instance `udf-v<counter>` naming) the second loop resolves `udf-v1` to the 
first loop's file, so the second executor loads `EchoOperator` and the 
assertion fails — I reproduced that red state before it passed against the 
fixed code.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


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