joeyutong opened a new pull request, #614:
URL: https://github.com/apache/flink-agents/pull/614
Linked issue: #612
### Purpose of change
This PR adds Python-side durable reconcile support based on a reconciler
callable.
It builds on the Java durable reconciler runtime introduced in #600 and adds
the Python API and runtime wiring needed to use the same recovery model from
Python actions.
This PR includes:
- a new optional `reconciler` keyword-only argument on Python
`RunnerContext.durable_execute(...)` and `durable_execute_async(...)`
- Python runtime support in `FlinkRunnerContext` for replaying previously
completed durable results and recovering successful outcomes through a
reconciler callable
- success-only reconciler semantics that match the merged Java contract:
- returning a result persists and replays the recovered successful outcome
- throwing an exception propagates that exception to the caller and does
not persist a recovered terminal outcome
- local runner support that accepts the new `reconciler` argument and
degrades to the existing non-durable behavior
- import-time decoupling from `AgentPlan` in Python runner modules, so
lightweight runner tests do not eagerly pull in the heavier plan/action/PyFlink
dependency chain
- a small Java bridge addition in `RunnerContextImpl` so the Python runtime
can read the current durable call result fields during recovery
The detailed design discussion is available here:
- Discussion: #598
### Tests
This change is covered by:
- `test_durable_execution.py`: verifies durable execution helpers and
reconciler callable validation
- `test_flink_runner_context_reconcilable.py`: verifies recovered success,
terminal replay, and exception propagation in the Flink runner context
- `test_local_runner_reconcilable.py`: verifies that local runner accepts
the new `reconciler` argument and degrades to the existing non-durable behavior
- Java runtime compile: verifies the new bridge method used by the Python
runtime compiles against the runtime module
### API
Yes.
This PR introduces Python public API changes:
- `RunnerContext.durable_execute(...)` adds an optional keyword-only
`reconciler: Callable[[], Any] | None = None`
- `RunnerContext.durable_execute_async(...)` adds the same optional
`reconciler` keyword-only argument
### Documentation
- [x] `doc-needed`
- [ ] `doc-not-needed`
- [ ] `doc-included`
--
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]