|
|
@ -80,22 +80,29 @@ public class TaskExecutionContextUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void createProcessLocalPathIfAbsent(TaskExecutionContext taskExecutionContext) throws TaskException { |
|
|
|
public static void createTaskInstanceWorkingDirectory(TaskExecutionContext taskExecutionContext) throws TaskException { |
|
|
|
|
|
|
|
// local execute path
|
|
|
|
|
|
|
|
String taskInstanceWorkingDirectory = FileUtils.getProcessExecDir( |
|
|
|
|
|
|
|
taskExecutionContext.getTenantCode(), |
|
|
|
|
|
|
|
taskExecutionContext.getProjectCode(), |
|
|
|
|
|
|
|
taskExecutionContext.getProcessDefineCode(), |
|
|
|
|
|
|
|
taskExecutionContext.getProcessDefineVersion(), |
|
|
|
|
|
|
|
taskExecutionContext.getProcessInstanceId(), |
|
|
|
|
|
|
|
taskExecutionContext.getTaskInstanceId()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
// local execute path
|
|
|
|
Path path = Paths.get(taskInstanceWorkingDirectory); |
|
|
|
String execLocalPath = FileUtils.getProcessExecDir( |
|
|
|
if (Files.deleteIfExists(path)) { |
|
|
|
taskExecutionContext.getTenantCode(), |
|
|
|
log.warn("The TaskInstance WorkingDirectory: {} is exist, will recreate again", |
|
|
|
taskExecutionContext.getProjectCode(), |
|
|
|
taskInstanceWorkingDirectory); |
|
|
|
taskExecutionContext.getProcessDefineCode(), |
|
|
|
} |
|
|
|
taskExecutionContext.getProcessDefineVersion(), |
|
|
|
Files.createDirectories(path); |
|
|
|
taskExecutionContext.getProcessInstanceId(), |
|
|
|
taskExecutionContext.setExecutePath(taskInstanceWorkingDirectory); |
|
|
|
taskExecutionContext.getTaskInstanceId()); |
|
|
|
|
|
|
|
taskExecutionContext.setExecutePath(execLocalPath); |
|
|
|
taskExecutionContext.setExecutePath(taskInstanceWorkingDirectory); |
|
|
|
taskExecutionContext.setAppInfoPath(FileUtils.getAppInfoPath(execLocalPath)); |
|
|
|
taskExecutionContext.setAppInfoPath(FileUtils.getAppInfoPath(taskInstanceWorkingDirectory)); |
|
|
|
Path executePath = Paths.get(taskExecutionContext.getExecutePath()); |
|
|
|
|
|
|
|
FileUtils.createDirectoryIfNotPresent(executePath); |
|
|
|
|
|
|
|
} catch (Throwable ex) { |
|
|
|
} catch (Throwable ex) { |
|
|
|
throw new TaskException("Cannot create process execute dir", ex); |
|
|
|
throw new TaskException( |
|
|
|
|
|
|
|
"Cannot create TaskInstance WorkingDirectory: " + taskInstanceWorkingDirectory + " failed", ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|