@ -23,6 +23,7 @@ import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.WarningType ;
import org.apache.dolphinscheduler.common.storage.StorageOperate ;
import org.apache.dolphinscheduler.common.utils.CommonUtils ;
import org.apache.dolphinscheduler.common.utils.DateUtils ;
import org.apache.dolphinscheduler.common.utils.JSONUtils ;
import org.apache.dolphinscheduler.common.utils.LoggerUtils ;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTask ;
@ -44,6 +45,7 @@ import org.apache.dolphinscheduler.service.alert.AlertClientService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager ;
import org.apache.dolphinscheduler.service.utils.ProcessUtils ;
import javax.annotation.Nullable ;
import java.io.File ;
import java.io.IOException ;
import java.nio.file.NoSuchFileException ;
@ -90,7 +92,7 @@ public abstract class WorkerTaskExecuteRunnable implements Runnable {
this . alertClientService = alertClientService ;
this . taskPluginManager = taskPluginManager ;
this . storageOperate = storageOperate ;
String taskLogName = LoggerUtils . buildTaskId ( taskExecutionContext . getFirstSubmitTime ( ) ,
String taskLogName = LoggerUtils . buildTaskId ( DateUtils . timeStampToDate ( taskExecutionContext . getFirstSubmitTime ( ) ) ,
taskExecutionContext . getProcessDefineCode ( ) ,
taskExecutionContext . getProcessDefineVersion ( ) ,
taskExecutionContext . getProcessInstanceId ( ) ,
@ -118,7 +120,7 @@ public abstract class WorkerTaskExecuteRunnable implements Runnable {
cancelTask ( ) ;
TaskExecutionContextCacheManager . removeByTaskInstanceId ( taskExecutionContext . getTaskInstanceId ( ) ) ;
taskExecutionContext . setCurrentExecutionStatus ( TaskExecutionStatus . FAILURE ) ;
taskExecutionContext . setEndTime ( new Date ( ) ) ;
taskExecutionContext . setEndTime ( System . currentTimeMillis ( ) ) ;
workerMessageSender . sendMessageWithRetry ( taskExecutionContext , masterAddress , CommandType . TASK_EXECUTE_RESULT ) ;
logger . info (
"Get a exception when execute the task, will send the task execute result to master, the current task execute result is {}" ,
@ -157,7 +159,7 @@ public abstract class WorkerTaskExecuteRunnable implements Runnable {
if ( Constants . DRY_RUN_FLAG_YES = = taskExecutionContext . getDryRun ( ) ) {
taskExecutionContext . setCurrentExecutionStatus ( TaskExecutionStatus . SUCCESS ) ;
taskExecutionContext . setEndTime ( new Date ( ) ) ;
taskExecutionContext . setEndTime ( System . currentTimeMillis ( ) ) ;
TaskExecutionContextCacheManager . removeByTaskInstanceId ( taskExecutionContext . getTaskInstanceId ( ) ) ;
workerMessageSender . sendMessageWithRetry ( taskExecutionContext , masterAddress ,
CommandType . TASK_EXECUTE_RESULT ) ;
@ -185,7 +187,7 @@ public abstract class WorkerTaskExecuteRunnable implements Runnable {
protected void initializeTask ( ) {
logger . info ( "Begin to initialize task" ) ;
Date taskStartTime = new Date ( ) ;
long taskStartTime = System . currentTimeMillis ( ) ;
taskExecutionContext . setStartTime ( taskStartTime ) ;
logger . info ( "Set task startTime: {}" , taskStartTime ) ;
@ -251,7 +253,7 @@ public abstract class WorkerTaskExecuteRunnable implements Runnable {
protected void sendTaskResult ( ) {
taskExecutionContext . setCurrentExecutionStatus ( task . getExitStatus ( ) ) ;
taskExecutionContext . setEndTime ( new Date ( ) ) ;
taskExecutionContext . setEndTime ( System . currentTimeMillis ( ) ) ;
taskExecutionContext . setProcessId ( task . getProcessId ( ) ) ;
taskExecutionContext . setAppIds ( task . getAppIds ( ) ) ;
taskExecutionContext . setVarPool ( JSONUtils . toJsonString ( task . getParameters ( ) . getVarPool ( ) ) ) ;