From fd9f97d03b69de8b3cb3d6fc7c42f03947cb4399 Mon Sep 17 00:00:00 2001 From: v-zhangjc9 Date: Fri, 17 May 2024 18:05:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(executor-manager):=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8A=A8=E6=80=81=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 1 + .../manager/configuration/ExecutorConfiguration.java | 9 +++++++++ .../executor/manager/service/ExecutorTaskService.java | 2 ++ .../service-executor-task/src/main/resources/logback.xml | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/service-cli/service-cli-runner/src/main/resources/application.yml b/service-cli/service-cli-runner/src/main/resources/application.yml index ed4fcdb..1c8774b 100644 --- a/service-cli/service-cli-runner/src/main/resources/application.yml +++ b/service-cli/service-cli-runner/src/main/resources/application.yml @@ -164,6 +164,7 @@ deploy: "[connector.hadoop.kerberos-principal]": ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM "[connector.hadoop.kerberos-keytab-path]": ${deploy.runtime.kerberos-keytab-path} arguments: + "[executor.loki-push-url]": ${deploy.runtime.loki.hudi-push-url} "[executor.task-jar-path]": ${deploy.runtime.executor.task-jar-path} "[executor.task-result-path]": ${deploy.runtime.executor.task-result-path} service-web: diff --git a/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/configuration/ExecutorConfiguration.java b/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/configuration/ExecutorConfiguration.java index c0d3484..2d9f905 100644 --- a/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/configuration/ExecutorConfiguration.java +++ b/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/configuration/ExecutorConfiguration.java @@ -16,9 +16,18 @@ import org.springframework.stereotype.Component; public class ExecutorConfiguration { private static final Logger logger = LoggerFactory.getLogger(ExecutorConfiguration.class); + private String lokiPushUrl; private String taskJarPath; private String taskResultPath; + public String getLokiPushUrl() { + return lokiPushUrl; + } + + public void setLokiPushUrl(String lokiPushUrl) { + this.lokiPushUrl = lokiPushUrl; + } + public String getTaskJarPath() { return taskJarPath; } diff --git a/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/service/ExecutorTaskService.java b/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/service/ExecutorTaskService.java index 37f0066..37faa33 100644 --- a/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/service/ExecutorTaskService.java +++ b/service-executor/service-executor-manager/src/main/java/com/lanyuanxiaoyao/service/executor/manager/service/ExecutorTaskService.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; import com.fasterxml.jackson.databind.ObjectMapper; +import com.lanyuanxiaoyao.service.common.Constants; import com.lanyuanxiaoyao.service.executor.Runner; import com.lanyuanxiaoyao.service.executor.core.TaskConstants; import com.lanyuanxiaoyao.service.executor.core.TaskContext; @@ -133,6 +134,7 @@ public class ExecutorTaskService { configuration.setString(YarnConfigOptions.APPLICATION_NAME, StrUtil.format("Service_Task {} #{}", name, taskId)); setEnvironment(configuration, "task_id", taskId); + setEnvironment(configuration, Constants.LOKI_PUSH_URL, executorConfiguration.getLokiPushUrl()); // 业务jar包 String executorJarPath = getLatestExecutorJarPath(); diff --git a/service-executor/service-executor-task/src/main/resources/logback.xml b/service-executor/service-executor-task/src/main/resources/logback.xml index 2c343b0..def33e9 100644 --- a/service-executor/service-executor-task/src/main/resources/logback.xml +++ b/service-executor/service-executor-task/src/main/resources/logback.xml @@ -3,7 +3,7 @@ INFO - http://132.126.207.126:33100/loki/api/v1/push + ${loki_push_url:- } %d{yyyy-MM-dd HH:mm:ss.SSS} [${HOSTNAME}] %-5level ${PID:- } --- [%t] %-40.40logger{39} #@# : %m%n