Browse Source

move updateTaskState into try/catch block in case of exception (#1003)

* move updateTaskState into try/catch block in case of exception

* fix NPE
Tboy 5 years ago
parent
commit
dd7b1b1d0c

+ 1 - 0
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/SchedulerService.java

@@ -450,6 +450,7 @@ public class SchedulerService extends BaseService {
         Schedule schedule = processDao.querySchedule(scheduleId);
         if (schedule == null) {
             logger.warn("process schedule info not exists");
+            return;
         }
 
         Date startDate = schedule.getStartTime();

+ 1 - 1
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java

@@ -129,7 +129,7 @@ public class PropertyUtils {
             return Boolean.parseBoolean(value);
         }
 
-        return null;
+        return false;
     }
 
     /**

+ 3 - 3
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskScheduleThread.java

@@ -82,10 +82,10 @@ public class TaskScheduleThread implements Runnable {
     @Override
     public void run() {
 
-        // update task state is running according to task type
-        updateTaskState(taskInstance.getTaskType());
-
         try {
+            // update task state is running according to task type
+            updateTaskState(taskInstance.getTaskType());
+
             logger.info("script path : {}", taskInstance.getExecutePath());
             // task node
             TaskNode taskNode = JSONObject.parseObject(taskInstance.getTaskJson(), TaskNode.class);