You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ca...@apache.org on 2022/01/13 03:23:02 UTC
[dolphinscheduler] branch 2.0.3-prepare updated: to #7981 (#7982)
This is an automated email from the ASF dual-hosted git repository.
caishunfeng pushed a commit to branch 2.0.3-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/2.0.3-prepare by this push:
new 8892745 to #7981 (#7982)
8892745 is described below
commit 889274562e146c6904cf171ff68d2c2a7d27cd55
Author: zwZjut <zw...@163.com>
AuthorDate: Thu Jan 13 11:11:20 2022 +0800
to #7981 (#7982)
Co-authored-by: honghuo.zw <ho...@alibaba-inc.com>
---
.../server/master/runner/task/CommonTaskProcessor.java | 16 ++++++++++++++++
.../apache/dolphinscheduler/spi/task/TaskConstants.java | 3 +++
2 files changed, 19 insertions(+)
diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
index ca78ea3..abe2da5 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
+++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
@@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.server.master.runner.task;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.remote.command.TaskKillRequestCommand;
@@ -33,11 +34,14 @@ import org.apache.dolphinscheduler.service.queue.TaskPriority;
import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue;
import org.apache.dolphinscheduler.service.queue.TaskPriorityQueueImpl;
import org.apache.dolphinscheduler.service.queue.entity.TaskExecutionContext;
+import org.apache.dolphinscheduler.spi.task.TaskConstants;
import org.apache.commons.lang.StringUtils;
import java.util.Date;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
@@ -45,6 +49,8 @@ import org.springframework.beans.factory.annotation.Autowired;
*/
public class CommonTaskProcessor extends BaseTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger(CommonTaskProcessor.class);
+
@Autowired
private TaskPriorityQueue taskUpdateQueue;
@@ -63,6 +69,16 @@ public class CommonTaskProcessor extends BaseTaskProcessor {
}
@Override
+ public void setTaskExecutionLogger() {
+ threadLoggerInfoName = LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX,
+ processInstance.getProcessDefinitionCode(),
+ processInstance.getProcessDefinitionVersion(),
+ taskInstance.getProcessInstanceId(),
+ taskInstance.getId());
+ Thread.currentThread().setName(String.format(TaskConstants.MASTER_COMMON_TASK_LOGGER_THREAD_NAME_FORMAT, threadLoggerInfoName));
+ }
+
+ @Override
public ExecutionStatus taskState() {
return this.taskInstance.getState();
}
diff --git a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java
index ed1f823..a3a1f92 100644
--- a/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java
+++ b/dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/TaskConstants.java
@@ -133,6 +133,9 @@ public class TaskConstants {
*/
public static final String TASK_LOGGER_THREAD_NAME_FORMAT = TASK_LOGGER_THREAD_NAME + "-%s";
+ public static final String MASTER_COMMON_TASK_LOGGER_THREAD_NAME = "CommonTask";
+
+ public static final String MASTER_COMMON_TASK_LOGGER_THREAD_NAME_FORMAT = MASTER_COMMON_TASK_LOGGER_THREAD_NAME + "-%s";
/**
* task log logger name
*/