|
@@ -27,9 +27,12 @@ import org.apache.dolphinscheduler.common.thread.ThreadUtils;
|
|
|
import org.apache.dolphinscheduler.common.utils.*;
|
|
|
import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand;
|
|
|
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
|
|
|
+import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager;
|
|
|
+import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl;
|
|
|
import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService;
|
|
|
import org.apache.dolphinscheduler.server.worker.task.AbstractTask;
|
|
|
import org.apache.dolphinscheduler.server.worker.task.TaskManager;
|
|
|
+import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
@@ -63,6 +66,11 @@ public class TaskExecuteThread implements Runnable {
|
|
|
*/
|
|
|
private TaskCallbackService taskCallbackService;
|
|
|
|
|
|
+ /**
|
|
|
+ * taskExecutionContextCacheManager
|
|
|
+ */
|
|
|
+ private TaskExecutionContextCacheManager taskExecutionContextCacheManager;
|
|
|
+
|
|
|
/**
|
|
|
* constructor
|
|
|
* @param taskExecutionContext taskExecutionContext
|
|
@@ -71,6 +79,7 @@ public class TaskExecuteThread implements Runnable {
|
|
|
public TaskExecuteThread(TaskExecutionContext taskExecutionContext, TaskCallbackService taskCallbackService){
|
|
|
this.taskExecutionContext = taskExecutionContext;
|
|
|
this.taskCallbackService = taskCallbackService;
|
|
|
+ this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -134,6 +143,7 @@ public class TaskExecuteThread implements Runnable {
|
|
|
responseCommand.setAppIds(task.getAppIds());
|
|
|
} finally {
|
|
|
try {
|
|
|
+ taskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId());
|
|
|
taskCallbackService.sendResult(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command());
|
|
|
}catch (Exception e){
|
|
|
ThreadUtils.sleep(Constants.SLEEP_TIME_MILLIS);
|