You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by he...@apache.org on 2022/10/21 07:06:11 UTC

[inlong] branch master updated: [INLONG-6243][Sort] Support custom name for Sort job (#6244)

This is an automated email from the ASF dual-hosted git repository.

healchow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 8da1c8bb8 [INLONG-6243][Sort] Support custom name for Sort job (#6244)
8da1c8bb8 is described below

commit 8da1c8bb84948c24cca725c97080f860b35f86bc
Author: Charles <44...@users.noreply.github.com>
AuthorDate: Fri Oct 21 15:06:04 2022 +0800

    [INLONG-6243][Sort] Support custom name for Sort job (#6244)
---
 .../org/apache/inlong/sort/configuration/Constants.java     | 13 ++++++++++++-
 .../src/main/java/org/apache/inlong/sort/Entrance.java      |  2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/configuration/Constants.java b/inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/configuration/Constants.java
index e4d6a3906..a966f705a 100644
--- a/inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/configuration/Constants.java
+++ b/inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/configuration/Constants.java
@@ -18,7 +18,6 @@
 package org.apache.inlong.sort.configuration;
 
 import java.time.Duration;
-
 import static org.apache.inlong.sort.configuration.ConfigOptions.key;
 
 /**
@@ -90,12 +89,24 @@ public class Constants {
     // ------------------------------------------------------------------------
     //  Common configs
     // ------------------------------------------------------------------------
+    /**
+     * The pipeline name is the key of configuration
+     * that represents the configuration of {@link this#JOB_NAME} in Flink Table API
+     */
+    public static final String PIPELINE_NAME = "pipeline.name";
+
     /**
      * The ID of the cluster, used to separate multiple clusters.
      */
     public static final ConfigOption<String> CLUSTER_ID = key("cluster-id").noDefaultValue()
             .withDescription("The ID of the cluster, used to separate multiple clusters.");
 
+    /**
+     * The job name of this job, default is 'InLong-Sort-Job'
+     */
+    public static final ConfigOption<String> JOB_NAME = key("job.name").defaultValue("InLong-Sort-Job")
+            .withDescription("The job name of this job");
+
     /**
      * The ZooKeeper quorum to use.
      */
diff --git a/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/Entrance.java b/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/Entrance.java
index b21f91aba..f6f91eac4 100644
--- a/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/Entrance.java
+++ b/inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/Entrance.java
@@ -52,6 +52,8 @@ public class Entrance {
         EnvironmentSettings settings = EnvironmentSettings.newInstance().useBlinkPlanner()
                 .inStreamingMode().build();
         StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, settings);
+        tableEnv.getConfig().getConfiguration().setString(Constants.PIPELINE_NAME,
+                config.getString(Constants.JOB_NAME));
         String sqlFile = config.getString(Constants.SQL_SCRIPT_FILE);
         Parser parser;
         if (StringUtils.isEmpty(sqlFile)) {