This is an automated email from the ASF dual-hosted git repository.

chenxingchun pushed a commit to branch 1.3.4-prepare
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/1.3.4-prepare by this push:
     new 9de1afc  fix time cover
     new 4acd4eb  Merge pull request #4246 from CalvinKirs/rerun_time_error
9de1afc is described below

commit 9de1afc3e4631932a6ecb26048e4e61a1994618c
Author: CalvinKirs <[email protected]>
AuthorDate: Wed Dec 16 15:35:16 2020 +0800

    fix time cover
---
 .../dolphinscheduler/server/worker/task/shell/ShellTask.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java
index 3dacc1c..a331765 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java
@@ -41,6 +41,7 @@ import java.nio.file.StandardOpenOption;
 import java.nio.file.attribute.FileAttribute;
 import java.nio.file.attribute.PosixFilePermission;
 import java.nio.file.attribute.PosixFilePermissions;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -138,11 +139,15 @@ public class ShellTask extends AbstractTask {
         CommandType.of(taskExecutionContext.getCmdTypeIfComplement()),
         taskExecutionContext.getScheduleTime());
     // replace variable TIME with $[YYYYmmddd...] in shell file when history 
run job and batch complement job
-    if (taskExecutionContext.getScheduleTime() != null && 
CommandType.COMPLEMENT_DATA.getCode() == 
taskExecutionContext.getCmdTypeIfComplement()) {
+    if (taskExecutionContext.getScheduleTime() != null) {
       if (paramsMap == null) {
         paramsMap = new HashMap<>();
       }
-      String dateTime = 
DateUtils.format(DateUtils.add(taskExecutionContext.getScheduleTime(), 
DAY_OF_MONTH, 1), Constants.PARAMETER_FORMAT_TIME);
+      Date date = taskExecutionContext.getScheduleTime();
+      if (CommandType.COMPLEMENT_DATA.getCode() == 
taskExecutionContext.getCmdTypeIfComplement()) {
+        date = DateUtils.add(taskExecutionContext.getScheduleTime(), 
DAY_OF_MONTH, 1);
+      }
+      String dateTime = DateUtils.format(date, 
Constants.PARAMETER_FORMAT_TIME);
       Property p = new Property();
       p.setValue(dateTime);
       p.setProp(Constants.PARAMETER_DATETIME);

Reply via email to