You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by we...@apache.org on 2022/11/01 01:30:26 UTC

[dolphinscheduler] 01/05: Catch exception when insert alert failed (#179)

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

wenjun pushed a commit to branch dev_wenjun_coronationTask
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git

commit 7e7b05185269b27867535824b16e2ea0f9ab5ea5
Author: Wenjun Ruan <we...@apache.org>
AuthorDate: Wed Oct 26 11:33:59 2022 +0800

    Catch exception when insert alert failed (#179)
---
 .../master/runner/WorkflowExecuteRunnable.java     | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
index e102238178..24d5d31451 100644
--- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
+++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
@@ -359,13 +359,21 @@ public class WorkflowExecuteRunnable implements Callable<WorkflowSubmitStatue> {
     }
 
     public void processTimeout() {
-        ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
-        this.processAlertManager.sendProcessTimeoutAlert(this.processInstance, projectUser);
+        try {
+            ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
+            this.processAlertManager.sendProcessTimeoutAlert(this.processInstance, projectUser);
+        } catch (Exception ex) {
+            logger.error("Send workflow instance timeout alert error", ex);
+        }
     }
 
     public void taskTimeout(TaskInstance taskInstance) {
-        ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
-        processAlertManager.sendTaskTimeoutAlert(processInstance, taskInstance, projectUser);
+        try {
+            ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
+            processAlertManager.sendTaskTimeoutAlert(processInstance, taskInstance, projectUser);
+        } catch (Exception ex) {
+            logger.error("Send task instance timeout alert error", ex);
+        }
     }
 
     public void taskFinished(TaskInstance taskInstance) throws StateEventHandleException {
@@ -802,7 +810,12 @@ public class WorkflowExecuteRunnable implements Callable<WorkflowSubmitStatue> {
         }
         ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
         if (processAlertManager.isNeedToSendWarning(processInstance)) {
-            processAlertManager.sendAlertProcessInstance(processInstance, getValidTaskList(), projectUser);
+            try {
+                processAlertManager.sendAlertProcessInstance(processInstance, getValidTaskList(), projectUser);
+            } catch (Exception ex) {
+                // the trace id has been set on upstream
+                logger.error("Send workflow instance alert failed");
+            }
         }
         if (processInstance.getState().typeIsSuccess()) {
             processAlertManager.closeAlert(processInstance);