You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/01 10:11:12 UTC

[GitHub] [flink] TisonKun commented on a change in pull request #11460: [FLINK-16655][FLINK-16657] Introduce embedded executor and use it for Web Submission

TisonKun commented on a change in pull request #11460: [FLINK-16655][FLINK-16657] Introduce embedded executor and use it for Web Submission
URL: https://github.com/apache/flink/pull/11460#discussion_r401495584
 
 

 ##########
 File path: flink-clients/src/main/java/org/apache/flink/client/deployment/application/DetachedApplicationRunner.java
 ##########
 @@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.client.deployment.application;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.client.ClientUtils;
+import org.apache.flink.client.deployment.application.executors.EmbeddedExecutor;
+import org.apache.flink.client.deployment.application.executors.EmbeddedExecutorServiceLoader;
+import org.apache.flink.client.program.PackagedProgram;
+import org.apache.flink.client.program.ProgramInvocationException;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.DeploymentOptions;
+import org.apache.flink.core.execution.PipelineExecutorServiceLoader;
+import org.apache.flink.runtime.dispatcher.DispatcherGateway;
+import org.apache.flink.util.FlinkRuntimeException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static java.util.Objects.requireNonNull;
+import static org.apache.flink.util.Preconditions.checkState;
+
+/**
+ * An {@link ApplicationRunner} which runs the user specified application
+ * using the {@link EmbeddedExecutor}.
+ * For this to work, this runner has to run on the same machine as the {@link DispatcherGateway}
+ * of the cluster, thus it does not go through REST to communicate with it.
+ *
+ * <p>In addition, this runner does not wait for the application to finish, but it submits the
+ * application in a {@code DETACHED} mode. As a consequence, applications with jobs that rely on
+ * operations like {@code [collect, print, printToErr, count]} will fail.
+ */
+@Internal
+public class DetachedApplicationRunner implements ApplicationRunner {
+
+	private static final Logger LOG = LoggerFactory.getLogger(DetachedApplicationRunner.class);
+
+	@Override
+	public List<JobID> run(final DispatcherGateway dispatcherGateway, final PackagedProgram program, final Configuration configuration) {
+		requireNonNull(dispatcherGateway);
 
 Review comment:
   Since Flink has `Preconditions#checkNotNull`, I'm curious whether this one or that one we choose for checking nonnull value.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services