Skip to content

Commit

Permalink
delete duplicate conf
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Oct 9, 2023
1 parent 80b2be5 commit d9935d4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 42 deletions.
2 changes: 0 additions & 2 deletions linkis-dist/package/conf/linkis-et-monitor.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ linkis.monitor.user.enginelist=[{"engineType":"hive-2.3.3","code":"show tables",
{"engineType":"spark-2.4.3","code":"show tables","runType":"sql","executeUser":"hadoop"},\
{"engineType":"shell-1","code":"pwd","runType":"sh","executeUser":"hadoop"}]

linkis.monitor.user.authToken=BML-AUTH

linkis.monitor.user.mode.timeOut=300


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ public class MonitorConfig {

public static final String shellPath = Configuration.getLinkisHome() + "/admin/";

public static final CommonVars<String> GATEWAY_URL = CommonVars.apply("wds.linkis.gateway.url");

public static final CommonVars<Integer> USER_MODE_TIMEOUT =
CommonVars.apply("linkis.monitor.user.timeOut", 300);
public static final CommonVars<String> USER_MODE_AUTHTOKEN =
CommonVars.apply("linkis.monitor.user.authToken", "BML-AUTH");
public static final CommonVars<String> USER_MODE_ENGINE =
CommonVars.apply("linkis.monitor.user.enginelist", "[]");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.linkis.monitor.scheduled;

import org.apache.linkis.common.ServiceInstance;
import org.apache.linkis.common.conf.Configuration;
import org.apache.linkis.governance.common.conf.GovernanceCommonConf;
import org.apache.linkis.monitor.config.MonitorConfig;
import org.apache.linkis.monitor.constants.Constants;
Expand Down Expand Up @@ -93,7 +94,7 @@ public void entranceTask() throws IOException {
HashMap<String, String> parms = new HashMap<>();
parms.put("$username", entranceEntity.get("username"));
parms.put("$alteruser", entranceEntity.get("alteruser"));
parms.put("$url", MonitorConfig.GATEWAY_URL.getValue());
parms.put("$url", Configuration.GATEWAY_URL().getValue());
// 获取标准阈值
if (runningtotal.intValue() > runningNumber) {
// 触发告警 用户运行任务满
Expand Down Expand Up @@ -130,7 +131,7 @@ public void entranceTask() throws IOException {
BigDecimal total = runningNumber.add(queuedNumber);

HashMap<String, String> parms = new HashMap<>();
parms.put("$url", MonitorConfig.GATEWAY_URL.getValue());
parms.put("$url", Configuration.GATEWAY_URL().getValue());
int linkisTotalMajor = MonitorConfig.ENTRANCE_TASK_TOTAL_MAJOR.getValue();
int linkisTotalMinor = MonitorConfig.ENTRANCE_TASK_TOTAL_MINOR.getValue();
if (total.intValue() >= linkisTotalMajor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.linkis.monitor.scheduled;

import org.apache.linkis.common.conf.Configuration;
import org.apache.linkis.common.utils.Utils;
import org.apache.linkis.governance.common.entity.task.RequestPersistTask;
import org.apache.linkis.httpclient.dws.config.DWSClientConfig;
Expand Down Expand Up @@ -77,7 +78,7 @@ public void job() {
jobExecuteResult.taskID());
HashMap<String, String> parms = new HashMap<>();
parms.put("$engineType", engine.get("engineType"));
parms.put("$url", MonitorConfig.GATEWAY_URL.getValue());
parms.put("$url", Configuration.GATEWAY_URL().getValue());
parms.put("$jobId", jobExecuteResult.taskID());
Utils.sleepQuietly(MonitorConfig.USER_MODE_TIMEOUT.getValue() * 1000);
JobInfoResult jobInfo = client.getJobInfo(jobExecuteResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.linkis.monitor.until;

import org.apache.linkis.bml.conf.BmlConfiguration;
import org.apache.linkis.common.conf.Configuration;
import org.apache.linkis.common.utils.Utils;
import org.apache.linkis.httpclient.dws.authentication.TokenAuthenticationStrategy;
Expand All @@ -25,7 +26,6 @@
import org.apache.linkis.monitor.client.MonitorHTTPClient;
import org.apache.linkis.monitor.client.MonitorHTTPClientClientImpl;
import org.apache.linkis.monitor.config.MonitorConfig;
import org.apache.linkis.monitor.constants.Constants;
import org.apache.linkis.monitor.entity.IndexEntity;
import org.apache.linkis.monitor.request.EmsListAction;
import org.apache.linkis.monitor.request.EntranceTaskAction;
Expand Down Expand Up @@ -90,26 +90,28 @@ public static DWSClientConfig createClientConfig(String url, Map<String, Object>
int maxConnection =
(int)
parms.getOrDefault(
Constants.CONNECTION_MAX_SIZE_SHORT_NAME(),
Constants.CONNECTION_MAX_SIZE().getValue());
BmlConfiguration.CONNECTION_MAX_SIZE_SHORT_NAME(),
BmlConfiguration.CONNECTION_MAX_SIZE().getValue());
int connectTimeout =
(int)
parms.getOrDefault(
Constants.CONNECTION_TIMEOUT_SHORT_NAME(),
Constants.CONNECTION_TIMEOUT().getValue());
BmlConfiguration.CONNECTION_TIMEOUT_SHORT_NAME(),
BmlConfiguration.CONNECTION_TIMEOUT().getValue());
int readTimeout =
(int)
parms.getOrDefault(
Constants.CONNECTION_READ_TIMEOUT_SHORT_NAME(),
Constants.CONNECTION_READ_TIMEOUT().getValue());
BmlConfiguration.CONNECTION_READ_TIMEOUT_SHORT_NAME(),
BmlConfiguration.CONNECTION_READ_TIMEOUT().getValue());
String tokenKey =
(String)
parms.getOrDefault(
Constants.AUTH_TOKEN_KEY_SHORT_NAME(), Constants.AUTH_TOKEN_KEY().getValue());
BmlConfiguration.AUTH_TOKEN_KEY_SHORT_NAME(),
BmlConfiguration.AUTH_TOKEN_KEY().getValue());
String tokenValue =
(String)
parms.getOrDefault(
Constants.AUTH_TOKEN_VALUE_SHORT_NAME(), Constants.AUTH_TOKEN_VALUE().getValue());
BmlConfiguration.AUTH_TOKEN_VALUE_SHORT_NAME(),
BmlConfiguration.AUTH_TOKEN_VALUE().getValue());

DWSClientConfig clientConfig =
((DWSClientConfigBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,6 @@ object Constants {
val SCAN_RULE_UNFINISHED_JOB_STATUS =
"Inited,WaitForRetry,Scheduled,Running".split(",").map(s => s.toUpperCase())

val LINKIS_API_VERSION: CommonVars[String] =
CommonVars[String]("linkis.monitor.bml.api.version", "v1")

val AUTH_TOKEN_KEY: CommonVars[String] =
CommonVars[String]("linkis.monitor.bml.auth.token.key", "Validation-Code")

val AUTH_TOKEN_VALUE: CommonVars[String] =
CommonVars[String]("linkis.monitor.bml.auth.token.value", "BML-AUTH")

val CONNECTION_MAX_SIZE: CommonVars[Int] =
CommonVars[Int]("linkis.monitor.bml.connection.max.size", 10)

val CONNECTION_TIMEOUT: CommonVars[Int] =
CommonVars[Int]("linkis.monitor.bml.connection.timeout", 5 * 60 * 1000)

val CONNECTION_READ_TIMEOUT: CommonVars[Int] =
CommonVars[Int]("linkis.monitor.bml.connection.read.timeout", 10 * 60 * 1000)

val AUTH_TOKEN_KEY_SHORT_NAME = "tokenKey"
val AUTH_TOKEN_VALUE_SHORT_NAME = "tokenValue"
val CONNECTION_MAX_SIZE_SHORT_NAME = "maxConnection"
val CONNECTION_TIMEOUT_SHORT_NAME = "connectTimeout"
val CONNECTION_READ_TIMEOUT_SHORT_NAME = "readTimeout"
val CLIENT_NAME_SHORT_NAME = "clientName"
val USER_LABEL_MONITOR = "jobhistory.label.monitor.im."

val USER_LABEL_TENANT: CommonVars[String] =
Expand Down

0 comments on commit d9935d4

Please sign in to comment.