|
|
|
@ -42,8 +42,6 @@ import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
|
|
|
|
|
import org.apache.dolphinscheduler.service.alert.AlertClientService; |
|
|
|
|
import org.apache.dolphinscheduler.service.task.TaskPluginManager; |
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.SystemUtils; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
@ -132,20 +130,6 @@ public class TaskExecuteProcessor implements NettyRequestProcessor {
|
|
|
|
|
taskExecutionContext.setHost(NetUtils.getAddr(workerConfig.getListenPort())); |
|
|
|
|
taskExecutionContext.setLogPath(LogUtils.getTaskLogPath(taskExecutionContext)); |
|
|
|
|
|
|
|
|
|
if (Constants.DRY_RUN_FLAG_NO == taskExecutionContext.getDryRun()) { |
|
|
|
|
boolean osUserExistFlag; |
|
|
|
|
//if Using distributed is true and Currently supported systems are linux,Should not let it automatically
|
|
|
|
|
//create tenants,so TenantAutoCreate has no effect
|
|
|
|
|
if (workerConfig.isTenantDistributedUser() && SystemUtils.IS_OS_LINUX) { |
|
|
|
|
//use the id command to judge in linux
|
|
|
|
|
osUserExistFlag = OSUtils.existTenantCodeInLinux(taskExecutionContext.getTenantCode()); |
|
|
|
|
} else if (CommonUtils.isSudoEnable() && workerConfig.isTenantAutoCreate()) { |
|
|
|
|
// if not exists this user, then create
|
|
|
|
|
OSUtils.createUserIfAbsent(taskExecutionContext.getTenantCode()); |
|
|
|
|
osUserExistFlag = OSUtils.getUserList().contains(taskExecutionContext.getTenantCode()); |
|
|
|
|
} else { |
|
|
|
|
osUserExistFlag = OSUtils.getUserList().contains(taskExecutionContext.getTenantCode()); |
|
|
|
|
} |
|
|
|
|
if (Constants.DRY_RUN_FLAG_NO == taskExecutionContext.getDryRun()) { |
|
|
|
|
if (CommonUtils.isSudoEnable() && workerConfig.isTenantAutoCreate()) { |
|
|
|
|
OSUtils.createUserIfAbsent(taskExecutionContext.getTenantCode()); |
|
|
|
@ -201,7 +185,8 @@ public class TaskExecuteProcessor implements NettyRequestProcessor {
|
|
|
|
|
boolean offer = workerManager.offer(new TaskExecuteThread(taskExecutionContext, |
|
|
|
|
taskCallbackService, |
|
|
|
|
alertClientService, |
|
|
|
|
taskPluginManager)); |
|
|
|
|
taskPluginManager, |
|
|
|
|
storageOperate)); |
|
|
|
|
if (!offer) { |
|
|
|
|
logger.error("submit task to manager error, queue is full, queue size is {}, taskInstanceId: {}", |
|
|
|
|
workerManager.getDelayQueueSize(), |
|
|
|
@ -209,6 +194,9 @@ public class TaskExecuteProcessor implements NettyRequestProcessor {
|
|
|
|
|
taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.FAILURE); |
|
|
|
|
taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
LoggerUtils.removeWorkflowAndTaskInstanceIdMDC(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|