seunggabi opened a new pull request, #30140:
URL: https://github.com/apache/flink/pull/30140
## What is the purpose of the change
`flink run` / `flink info` only accept a local job JAR, while Application
Mode already fetches remote JARs with `ArtifactFetchManager` (FLINK-28915).
Users of session clusters have to download the JAR before every submission
(e.g. a docker-compose job submitter running `aws s3 cp` before `flink run`).
This lets the CLI take the job JAR as a URI (`s3://`, `hdfs://`, `https://`,
...) and fetch it itself. It is client-side only and complements FLIP-613
(JobManager-side fetch for REST submissions): the CLI fetches with the
submitter's own credentials and uploads as today, so nothing changes on the
cluster.
Discussion: dev@ thread "[DISCUSS] FLINK-6405: Let flink run fetch the job
JAR from a remote URI". Opened as a draft until it is clear whether a FLIP is
needed.
## Brief change log
- `CliFrontend#getJarFile`: if no local file exists at the path and it has a
URI scheme, fetch it with `ArtifactFetchManager`.
- Fetched into a new directory under the first `io.tmp.dirs` entry per
action, since `ArtifactFetchManager` reuses an existing file of the same name
and would run a stale JAR. Fetched once per action, deleted when `run` / `info`
finishes (`deleteOnExit` covers an interrupted attached run).
- A local file with the same path wins; plain paths, Windows drive paths
and paths with spaces behave as before. `local://` is used in place.
- Clear errors for a URI without a file name and for an unusable
`io.tmp.dirs`.
- Application Mode (`run -t *-application`) and PyFlink entry points are
unchanged.
- CLI help text and `deployment/cli.md` (en, zh) document the URI form.
## Verifying this change
This change added tests (`CliFrontendRemoteJarTest`, a real HTTP server and
the real fetchers, no mocks):
- `run` and `info` fetch once and leave `io.tmp.dirs` empty afterwards
- the next action fetches again instead of reusing the old copy
- `local://` is used in place; URI without a file name; unusable
`io.tmp.dirs`; HTTP disabled; unsupported scheme
- path classification (URIs vs. plain, Windows and space-containing paths)
5 of the 6 initial tests fail with the fetch branch disabled. All
`CliFrontend*Test` pass (92), plus `checkstyle:check` and `spotless:check`.
Manually verified with the 2.3.0 distribution and `flink-s3-fs-hadoop`:
`flink run s3://<bucket>/<job>.jar` fetched the JAR from a real S3 bucket and
ran the program's `main()`; the temporary directory was removed afterwards. The
unpatched CLI fails with `JAR file does not exist: s3:/...`.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no (CLI behavior: accepts a URI where a local path was
required)
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no (used through the existing plugin)
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? docs (`deployment/cli.md`, en and
zh) and CLI help text
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Claude Opus 5.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]