You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by kk...@apache.org on 2019/10/25 14:47:53 UTC
[flink] 03/08: [FLINK-14501] Add the DeploymentOptions.TARGET
This is an automated email from the ASF dual-hosted git repository.
kkloudas pushed a commit to branch to-merge
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 8820f6dd7f3fb55e7f1b10aad0beebd7caf615f6
Author: Kostas Kloudas <kk...@gmail.com>
AuthorDate: Tue Oct 22 20:12:51 2019 +0200
[FLINK-14501] Add the DeploymentOptions.TARGET
---
docs/_includes/generated/deployment_configuration.html | 5 +++++
.../java/org/apache/flink/client/cli/AbstractCustomCommandLine.java | 2 ++
.../main/java/org/apache/flink/configuration/DeploymentOptions.java | 5 +++++
.../src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java | 1 +
4 files changed, 13 insertions(+)
diff --git a/docs/_includes/generated/deployment_configuration.html b/docs/_includes/generated/deployment_configuration.html
index bdac757..2c652e4 100644
--- a/docs/_includes/generated/deployment_configuration.html
+++ b/docs/_includes/generated/deployment_configuration.html
@@ -12,5 +12,10 @@
<td style="word-wrap: break-word;">false</td>
<td>Specifies if the pipeline is submitted in attached or detached mode.</td>
</tr>
+ <tr>
+ <td><h5>execution.target</h5></td>
+ <td style="word-wrap: break-word;">(none)</td>
+ <td>The deployment target for the execution, e.g. "local" for local execution.</td>
+ </tr>
</tbody>
</table>
diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/AbstractCustomCommandLine.java b/flink-clients/src/main/java/org/apache/flink/client/cli/AbstractCustomCommandLine.java
index 805d58a..cba1036 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/cli/AbstractCustomCommandLine.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/cli/AbstractCustomCommandLine.java
@@ -19,6 +19,7 @@
package org.apache.flink.client.cli;
import org.apache.flink.configuration.Configuration;
+import org.apache.flink.configuration.DeploymentOptions;
import org.apache.flink.configuration.HighAvailabilityOptions;
import org.apache.flink.configuration.UnmodifiableConfiguration;
import org.apache.flink.util.FlinkException;
@@ -72,6 +73,7 @@ public abstract class AbstractCustomCommandLine<T> implements CustomCommandLine<
@Override
public Configuration applyCommandLineOptionsToConfiguration(CommandLine commandLine) throws FlinkException {
final Configuration resultingConfiguration = new Configuration(configuration);
+ resultingConfiguration.setString(DeploymentOptions.TARGET, getId());
if (commandLine.hasOption(addressOption.getOpt())) {
String addressWithPort = commandLine.getOptionValue(addressOption.getOpt());
diff --git a/flink-core/src/main/java/org/apache/flink/configuration/DeploymentOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/DeploymentOptions.java
index 1addcc4..a032205 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/DeploymentOptions.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/DeploymentOptions.java
@@ -28,6 +28,11 @@ import static org.apache.flink.configuration.ConfigOptions.key;
@PublicEvolving
public class DeploymentOptions {
+ public static final ConfigOption<String> TARGET =
+ key("execution.target")
+ .noDefaultValue()
+ .withDescription("The deployment target for the execution, e.g. \"local\" for local execution.");
+
public static final ConfigOption<Boolean> ATTACHED =
key("execution.attached")
.defaultValue(false)
diff --git a/flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java b/flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java
index a831ab2..2aaa6fb 100644
--- a/flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java
+++ b/flink-yarn/src/main/java/org/apache/flink/yarn/cli/FlinkYarnSessionCli.java
@@ -443,6 +443,7 @@ public class FlinkYarnSessionCli extends AbstractCustomCommandLine<ApplicationId
public Configuration applyCommandLineOptionsToConfiguration(CommandLine commandLine) throws FlinkException {
// we ignore the addressOption because it can only contain "yarn-cluster"
final Configuration effectiveConfiguration = new Configuration(configuration);
+ effectiveConfiguration.setString(DeploymentOptions.TARGET, getId());
applyDescriptorOptionToConfig(commandLine, effectiveConfiguration);