joeyutong opened a new pull request, #1049:
URL: https://github.com/apache/flink-agents/pull/1049
Linked issue: #1048
### Purpose of change
`PythonActionExecutor` repeatedly creates Java-side Pemja `PyObject` handles
while a Python Action is running. Those handles own native Python references
and were previously dropped without calling `close()`.
This change:
- closes the temporary Python Event and coroutine wrappers after each Action
invocation;
- keeps the coroutine alive through the independent interpreter-global
reference established by `interpreter.set(...)`;
- closes the temporary wrapper returned by each `interpreter.get(...)` poll;
- deletes the interpreter-global coroutine reference after the coroutine
completes.
This is complementary to #944: that PR handles executor-lifetime objects
during attempt cleanup, while this PR handles objects created repeatedly during
the lifetime of an open executor.
### Tests
- Added `PythonActionExecutorTest` coverage for synchronous completion,
async storage, Action failure, `set` failure, pending/completed coroutine
polling, and polling failure.
- Ran `mvn -am -pl runtime -DskipITs -DskipPythonTests test`:
- API: 376 tests, 0 failures
- MCP: 39 tests, 0 failures
- Plan: 281 tests, 0 failures
- Runtime: 675 tests, 0 failures
- Spotless checks passed as part of the reactor build.
### API
No user-facing API changes. `PythonActionExecutor` is an internal runtime
bridge; its awaitable polling method now propagates `PyObject.close()` failures
through the existing `ActionTask.invoke(... ) throws Exception` path.
### Documentation
- [ ] `doc-needed`
- [x] `doc-not-needed`
- [ ] `doc-included`
### Was this patch authored or co-authored using generative AI tooling?
- [x] Yes
- [ ] No
Generated-by: Codex (GPT-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]