Skip to content

Commit 4acd4eb

Browse files
Merge pull request #4246 from CalvinKirs/rerun_time_error
fix re-run time error
2 parents 18ac68b + 9de1afc commit 4acd4eb

File tree

1 file changed

+7
-2
lines changed
  • dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell

1 file changed

+7
-2
lines changed

Diff for: dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.nio.file.attribute.FileAttribute;
4242
import java.nio.file.attribute.PosixFilePermission;
4343
import java.nio.file.attribute.PosixFilePermissions;
44+
import java.util.Date;
4445
import java.util.HashMap;
4546
import java.util.Map;
4647
import java.util.Set;
@@ -138,11 +139,15 @@ private String buildCommand() throws Exception {
138139
CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
139140
taskExecutionContext.getScheduleTime());
140141
// replace variable TIME with $[YYYYmmddd...] in shell file when history run job and batch complement job
141-
if (taskExecutionContext.getScheduleTime() != null && CommandType.COMPLEMENT_DATA.getCode() == taskExecutionContext.getCmdTypeIfComplement()) {
142+
if (taskExecutionContext.getScheduleTime() != null) {
142143
if (paramsMap == null) {
143144
paramsMap = new HashMap<>();
144145
}
145-
String dateTime = DateUtils.format(DateUtils.add(taskExecutionContext.getScheduleTime(), DAY_OF_MONTH, 1), Constants.PARAMETER_FORMAT_TIME);
146+
Date date = taskExecutionContext.getScheduleTime();
147+
if (CommandType.COMPLEMENT_DATA.getCode() == taskExecutionContext.getCmdTypeIfComplement()) {
148+
date = DateUtils.add(taskExecutionContext.getScheduleTime(), DAY_OF_MONTH, 1);
149+
}
150+
String dateTime = DateUtils.format(date, Constants.PARAMETER_FORMAT_TIME);
146151
Property p = new Property();
147152
p.setValue(dateTime);
148153
p.setProp(Constants.PARAMETER_DATETIME);

0 commit comments

Comments
 (0)