Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/5903#discussion_r184953698
--- Diff:
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarRunHandler.java
---
@@ -105,9 +110,32 @@ public JarRunHandler(
savepointRestoreSettings,
parallelism);
- return jobGraphFuture.thenCompose(jobGraph -> restClusterClient
- .submitJob(jobGraph)
- .thenApply((jobSubmitResponseBody -> new
JarRunResponseBody(jobGraph.getJobID()))))
+ CompletableFuture<Integer> blobServerPortFuture =
gateway.getBlobServerPort(timeout);
+
+ CompletableFuture<JobGraph> jarUploadFuture =
jobGraphFuture.thenCombine(blobServerPortFuture, (jobGraph, blobServerPort) -> {
+ final InetSocketAddress address = new
InetSocketAddress(getDispatcherHost(gateway), blobServerPort);
+ final List<PermanentBlobKey> keys;
+ try {
+ keys = BlobClient.uploadJarFiles(address,
configuration, jobGraph.getJobID(), jobGraph.getUserJars());
+ } catch (IOException ioe) {
+ throw new CompletionException(new
FlinkException("Could not upload job jar files.", ioe));
+ }
+
+ for (PermanentBlobKey key : keys) {
+ jobGraph.addBlob(key);
+ }
+
+ return jobGraph;
+ });
+
+ CompletableFuture<Acknowledge> jobSubmissionFuture =
jarUploadFuture.thenCompose(jobGraph -> {
+ // we have to enable queued scheduling because slots
will be allocated lazily
--- End diff --
If by `the thing sitting behind the REST endpoint` you mean the
`Dispatcher`, then no, it does not enable queued scheduling, but effectively
relies on it being enabled. If you don't enable it beforehand in the
client/handler the job submission will outright fail with an entirely unhelpful
error message.
The `Dispatcher` should _probably_ enable it though, but that isn't really
in the scope of this PR as it would also affect the `RestClusterClient` which
does the same thing.
Technically it may also be questionably as it would invalidate part of the
`JobGraph` API.
---