未验证 提交 be158328 编写于 作者: K Kirs 提交者: GitHub

[Bug #6306][Worker] task log path generated error. (#6338)

上级 9be7f793
...@@ -29,6 +29,7 @@ import org.apache.dolphinscheduler.common.utils.CommonUtils; ...@@ -29,6 +29,7 @@ import org.apache.dolphinscheduler.common.utils.CommonUtils;
import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.common.utils.RetryerUtils; import org.apache.dolphinscheduler.common.utils.RetryerUtils;
import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance;
...@@ -185,6 +186,12 @@ public class TaskExecuteThread implements Runnable, Delayed { ...@@ -185,6 +186,12 @@ public class TaskExecuteThread implements Runnable, Delayed {
throw new PluginNotFoundException(String.format("%s Task Plugin Not Found,Please Check Config File.", taskExecutionContext.getTaskType())); throw new PluginNotFoundException(String.format("%s Task Plugin Not Found,Please Check Config File.", taskExecutionContext.getTaskType()));
} }
TaskRequest taskRequest = JSONUtils.parseObject(JSONUtils.toJsonString(taskExecutionContext), TaskRequest.class); TaskRequest taskRequest = JSONUtils.parseObject(JSONUtils.toJsonString(taskExecutionContext), TaskRequest.class);
String taskLogName = LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX,
taskExecutionContext.getProcessDefineCode(),
taskExecutionContext.getProcessDefineVersion(),
taskExecutionContext.getProcessInstanceId(),
taskExecutionContext.getTaskInstanceId());
taskRequest.setTaskLogName(taskLogName);
task = taskChannel.createTask(taskRequest); task = taskChannel.createTask(taskRequest);
// task init // task init
......
...@@ -178,7 +178,18 @@ public class TaskRequest { ...@@ -178,7 +178,18 @@ public class TaskRequest {
*/ */
private int delayTime; private int delayTime;
/**
* Task Logger name should be like: Task-{processDefinitionId}-{processInstanceId}-{taskInstanceId}
*/
private String taskLogName;
public String getTaskLogName() {
return taskLogName;
}
public void setTaskLogName(String taskLogName) {
this.taskLogName = taskLogName;
}
/** /**
* resources full name and tenant code * resources full name and tenant code
......
...@@ -41,7 +41,7 @@ public abstract class AbstractTaskExecutor extends AbstractTask { ...@@ -41,7 +41,7 @@ public abstract class AbstractTaskExecutor extends AbstractTask {
*/ */
protected AbstractTaskExecutor(TaskRequest taskRequest) { protected AbstractTaskExecutor(TaskRequest taskRequest) {
super(taskRequest); super(taskRequest);
logger = LoggerFactory.getLogger(taskRequest.getLogPath()); logger = LoggerFactory.getLogger(taskRequest.getTaskLogName());
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册