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

[dolphinscheduler] branch dev updated: [2.0.3][Bug-7986] Disable deletion of running workflow (#8065)

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

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


The following commit(s) were added to refs/heads/dev by this push:
     new c0d6912  [2.0.3][Bug-7986] Disable deletion of running workflow (#8065)
c0d6912 is described below

commit c0d69125eb1c8ddb2993697533e9b490f2611cc1
Author: wind <ca...@users.noreply.github.com>
AuthorDate: Mon Jan 17 10:29:59 2022 +0800

    [2.0.3][Bug-7986] Disable deletion of running workflow (#8065)
    
    Co-authored-by: caishunfeng <53...@qq.com>
---
 .../api/service/impl/ProcessInstanceServiceImpl.java             | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
index 61af8f7..804ea76 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
@@ -606,6 +606,12 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
             putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, String.valueOf(processInstanceId));
             return result;
         }
+        //check process instance status
+        if (!processInstance.getState().typeIsFinished()) {
+            putMsg(result, Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR,
+                    processInstance.getName(), processInstance.getState().toString(), "delete");
+            return result;
+        }
 
         ProcessDefinition processDefinition = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
         if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
@@ -615,7 +621,8 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
 
         try {
             processService.removeTaskLogFile(processInstanceId);
-        } catch (Exception e) {
+        } catch (Exception ignore) {
+            // ignore
         }
 
         // delete database cascade