weiqingy opened a new pull request, #848:
URL: https://github.com/apache/flink-agents/pull/848
Linked issue: #847
### Purpose of change
`AgentsExecutionEnvironment.getExecutionEnvironment()` (no-arg) and the `env
== null` branch of the two-arg overload reflectively loaded
`org.apache.flink.agents.runtime.env.LocalExecutionEnvironment` — a class that
does not exist in the tree (the `runtime` `env/` package ships only
`RemoteExecutionEnvironment`) and never existed in git history. Both paths
could therefore only throw `RuntimeException("Failed to create
LocalExecutionEnvironment")` at runtime, while the Javadoc promised "a local
execution environment is returned for testing and development."
It went unnoticed because no Java code calls the no-arg form — every Java
example and test passes a real `StreamExecutionEnvironment`. But these are
public API methods, so a user following the Javadoc would hit an obscure
runtime failure.
This removes the no-arg overload and the dead `env == null` branch, and
requires a non-null `StreamExecutionEnvironment` (fail-fast `checkNotNull`).
Java agents always run on a Flink environment, so the remote path is the only
real one.
Cross-language parity note: Python's `get_execution_environment(env=None)`
still returns a working in-process local environment, so this makes Java
explicitly remote-only while Python keeps a local path. That asymmetry already
existed in practice (the Java no-arg form threw at runtime); this just makes it
explicit rather than a latent trap. Whether Python's local path should also
change is being evaluated separately in #829. If maintainers would rather
preserve Java↔Python parity, the alternative is to keep the no-arg signature
and implement a real Java local environment — happy to take that direction
instead; flagging it here.
### Tests
New `AgentsExecutionEnvironmentTest` asserts that a null
`StreamExecutionEnvironment` is rejected on both overloads. The full `api`
module suite passes (264 tests), and a full-reactor `mvn test-compile` succeeds
— confirming no caller anywhere relied on the removed method.
### API
Yes. Removes the public static no-arg
`AgentsExecutionEnvironment.getExecutionEnvironment()` and makes the `env`
parameter required. Safe because the removed method could only throw and had no
callers; the project is pre-1.0 (0.3-SNAPSHOT).
### Documentation
- [ ] `doc-needed`
- [x] `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]