This is an automated email from the ASF dual-hosted git repository.
cancai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new bb676d03d [Bug] fixed the CI failed (#3542)
bb676d03d is described below
commit bb676d03d5a1df7936f9b8a1411878123cf763c0
Author: benjobs <[email protected]>
AuthorDate: Sun Feb 11 17:19:50 2024 +0800
[Bug] fixed the CI failed (#3542)
* [Bug] fixed the CI failed
---
.../common/conf/InternalConfigHolder.scala | 5 --
.../console/StreamParkConsoleBootstrap.java | 6 +-
.../runner/EnvApplicationContextInitializer.java | 72 ----------------------
.../console/core/runner/EnvInitializer.java | 49 ++++++++++++---
.../src/main/resources/db/data-h2.sql | 2 +-
5 files changed, 41 insertions(+), 93 deletions(-)
diff --git
a/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
b/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
index 18aae4e8e..d61ac2ee3 100644
---
a/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
+++
b/streampark-common/src/main/scala/org/apache/streampark/common/conf/InternalConfigHolder.scala
@@ -43,11 +43,6 @@ object InternalConfigHolder extends Logger {
/** configuration key options storage (key -> ConfigOption) */
private val confOptions = new ConcurrentHashMap[String,
InternalOption](initialCapacity)
- /** Initialize the ConfigHub. */
- {
- Seq(CommonConfig, K8sFlinkConfig)
- }
-
/** Register the ConfigOption */
private[conf] def register(@Nonnull conf: InternalOption): Unit = {
confOptions.put(conf.key, conf)
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/StreamParkConsoleBootstrap.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/StreamParkConsoleBootstrap.java
index ac6c2c18e..9401e64cd 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/StreamParkConsoleBootstrap.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/StreamParkConsoleBootstrap.java
@@ -17,8 +17,6 @@
package org.apache.streampark.console;
-import
org.apache.streampark.console.core.runner.EnvApplicationContextInitializer;
-
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -49,8 +47,6 @@ import
org.springframework.scheduling.annotation.EnableScheduling;
public class StreamParkConsoleBootstrap {
public static void main(String[] args) {
- new SpringApplicationBuilder(StreamParkConsoleBootstrap.class)
- .initializers(new EnvApplicationContextInitializer())
- .run(args);
+ new SpringApplicationBuilder(StreamParkConsoleBootstrap.class).run(args);
}
}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvApplicationContextInitializer.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvApplicationContextInitializer.java
deleted file mode 100644
index 969766da5..000000000
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvApplicationContextInitializer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.streampark.console.core.runner;
-
-import org.apache.streampark.common.conf.ConfigKeys;
-import org.apache.streampark.common.conf.InternalConfigHolder;
-import org.apache.streampark.common.conf.InternalOption;
-import org.apache.streampark.common.util.Utils;
-import org.apache.streampark.console.base.util.WebUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import org.springframework.context.ApplicationContextInitializer;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.core.env.Environment;
-
-import java.util.Arrays;
-import java.util.Optional;
-
-public class EnvApplicationContextInitializer
- implements ApplicationContextInitializer<ConfigurableApplicationContext> {
-
- @Override
- public void initialize(ConfigurableApplicationContext context) {
- Optional<String> profile =
-
Arrays.stream(context.getEnvironment().getActiveProfiles()).findFirst();
- if ("test".equals(profile.orElse(null))) {
- return;
- }
-
- String appHome = WebUtils.getAppHome();
- if (StringUtils.isBlank(appHome)) {
- throw new ExceptionInInitializerError(
- String.format(
- "[StreamPark] System initialization check failed,"
- + " The system initialization check failed. If started local
for development and debugging,"
- + " please ensure the -D%s parameter is clearly specified,"
- + " more detail:
https://streampark.apache.org/docs/user-guide/deployment",
- ConfigKeys.KEY_APP_HOME()));
- }
-
- // init InternalConfig
- initInternalConfig(context.getEnvironment());
- }
-
- private void initInternalConfig(Environment springEnv) {
- // override config from spring application.yaml
- InternalConfigHolder.keys().stream()
- .filter(springEnv::containsProperty)
- .forEach(
- key -> {
- InternalOption config = InternalConfigHolder.getConfig(key);
- Utils.requireNotNull(config);
- InternalConfigHolder.set(config, springEnv.getProperty(key,
config.classType()));
- });
- }
-}
diff --git
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvInitializer.java
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvInitializer.java
index 9f6cd805b..c338c4779 100644
---
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvInitializer.java
+++
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/runner/EnvInitializer.java
@@ -20,6 +20,7 @@ package org.apache.streampark.console.core.runner;
import org.apache.streampark.common.conf.CommonConfig;
import org.apache.streampark.common.conf.ConfigKeys;
import org.apache.streampark.common.conf.InternalConfigHolder;
+import org.apache.streampark.common.conf.InternalOption;
import org.apache.streampark.common.conf.Workspace;
import org.apache.streampark.common.enums.StorageType;
import org.apache.streampark.common.fs.FsOperator;
@@ -40,6 +41,7 @@ import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.Order;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import java.io.File;
@@ -76,20 +78,36 @@ public class EnvInitializer implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
// init InternalConfig
- initInternalConfig();
- // overwrite system variable HADOOP_USER_NAME
- String hadoopUserName =
InternalConfigHolder.get(CommonConfig.STREAMPARK_HADOOP_USER_NAME());
- overrideSystemProp(ConfigKeys.KEY_HADOOP_USER_NAME(), hadoopUserName);
- // initialize local file system resources
- storageInitialize(LFS);
- // Launch the embedded http file server.
- ZIOExt.unsafeRun(EmbeddedFileServer.launch());
+ initConfig();
+
+ boolean isTest =
Arrays.asList(context.getEnvironment().getActiveProfiles()).contains("test");
+ if (!isTest) {
+ // initialize local file system resources
+ storageInitialize(LFS);
+ // Launch the embedded http file server.
+ ZIOExt.unsafeRun(EmbeddedFileServer.launch());
+ }
}
- private void initInternalConfig() {
+ private void initConfig() {
+
+ Environment env = context.getEnvironment();
+ // override config from spring application.yaml
+ InternalConfigHolder.keys().stream()
+ .filter(env::containsProperty)
+ .forEach(
+ key -> {
+ InternalOption config = InternalConfigHolder.getConfig(key);
+ Utils.requireNotNull(config);
+ InternalConfigHolder.set(config, env.getProperty(key,
config.classType()));
+ });
+ InternalConfigHolder.log();
+
settingService.getMavenConfig().updateConfig();
- InternalConfigHolder.log();
+ // overwrite system variable HADOOP_USER_NAME
+ String hadoopUserName =
InternalConfigHolder.get(CommonConfig.STREAMPARK_HADOOP_USER_NAME());
+ overrideSystemProp(ConfigKeys.KEY_HADOOP_USER_NAME(), hadoopUserName);
}
private void overrideSystemProp(String key, String defaultValue) {
@@ -99,6 +117,17 @@ public class EnvInitializer implements ApplicationRunner {
}
public synchronized void storageInitialize(StorageType storageType) {
+ String appHome = WebUtils.getAppHome();
+
+ if (StringUtils.isBlank(appHome)) {
+ throw new ExceptionInInitializerError(
+ String.format(
+ "[StreamPark] Workspace path check failed,"
+ + " The system initialization check failed. If started local
for development and debugging,"
+ + " please ensure the -D%s parameter is clearly specified,"
+ + " more detail:
https://streampark.apache.org/docs/user-guide/deployment",
+ ConfigKeys.KEY_APP_HOME()));
+ }
if (initialized.contains(storageType)) {
return;
diff --git
a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
index 5eadb987a..d418c26e2 100644
---
a/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
+++
b/streampark-console/streampark-console-service/src/main/resources/db/data-h2.sql
@@ -24,7 +24,7 @@ insert into `t_team` values (100001, 'test', 'The test team',
now(), now());
-- ----------------------------
-- Records of t_flink_app
-- ----------------------------
-insert into `t_flink_app` values (100000, 100000, 2, 4, null, null, 'Flink SQL
Demo', null, null, null, null, null, null , null, 100000, null, 1, null, null,
null, null, null, null, null, null, '0', 0, null, null, null, null, null, null,
'Flink SQL Demo', 0, null, null, null, null, null, null, null, 0, 0, now(),
now(), null, 1, 1, null, null, null, null, null, null, 0, null, null, null,
'streampark,test', 0);
+insert into `t_flink_app` values (100000, 100000, 2, 4, null, null, 'Flink SQL
Demo', null, null, null, null, null, null , null, 100000, null, 1, null, null,
null, null, null, null, null, null, '0', 0, null, null, null, null, null, null,
'Flink SQL Demo', 0, null, null, null, null, null, null, null, 0, 0, now(),
now(), null, 1, 1, null, null, null, null, null, null, 0, null, null, null,
'streampark,test', 0, null);
-- ----------------------------
-- Records of t_flink_effective