SbloodyS commented on code in PR #17132:
URL: 
https://github.com/apache/dolphinscheduler/pull/17132#discussion_r2048073669


##########
dolphinscheduler-api/src/test/resources/workflowImport/check_successful.json:
##########
@@ -0,0 +1,104 @@
+[ {
+  "workflowDefinition" : {
+    "id" : 1,
+    "code" : 1,
+    "name" : "shell_task",
+    "version" : 2,
+    "releaseState" : "ONLINE",
+    "projectCode" : 1,
+    "description" : "",
+    "globalParams" : "[]",
+    "globalParamList" : [ ],
+    "globalParamMap" : { },
+    "createTime" : "2025-04-13 13:16:51",
+    "updateTime" : "2025-04-13 14:18:51",
+    "flag" : "YES",
+    "userId" : 1,
+    "userName" : null,
+    "projectName" : null,
+    "locations" : "[{\"taskCode\":137713824398176,\"x\":59,\"y\":61}]",
+    "scheduleReleaseState" : null,
+    "schedule" : null,
+    "timeout" : 0,
+    "modifyBy" : null,
+    "warningGroupId" : null,
+    "executionType" : "PARALLEL"
+  },
+  "workflowTaskRelationList" : [ {
+    "id" : 2,
+    "name" : "",
+    "workflowDefinitionVersion" : 2,
+    "projectCode" : 1,
+    "workflowDefinitionCode" : 1,
+    "preTaskCode" : 0,
+    "preTaskVersion" : 0,
+    "postTaskCode" : 137713824398176,
+    "postTaskVersion" : 2,
+    "conditionType" : "NONE",
+    "conditionParams" : {},
+    "createTime" : "2025-04-13 14:18:51",
+    "updateTime" : "2025-04-13 14:18:51",
+    "operator" : 1,
+    "operateTime" : "2025-04-13 14:18:51"
+  } ],
+  "taskDefinitionList" : [ {
+    "id" : 2,
+    "code" : 1,
+    "name" : "sudo",
+    "version" : 2,
+    "description" : "",
+    "projectCode" : 1,
+    "userId" : 1,
+    "taskType" : "SHELL",
+    "taskParams" : {"localParams":[],"rawScript":"echo 2","resourceList":[]},
+    "taskParamList" : [ ],
+    "taskParamMap" : null,
+    "flag" : "YES",
+    "taskPriority" : "MEDIUM",
+    "userName" : null,
+    "projectName" : null,
+    "workerGroup" : "default",
+    "environmentCode" : -1,
+    "failRetryTimes" : 0,
+    "failRetryInterval" : 1,
+    "timeoutFlag" : "CLOSE",
+    "timeoutNotifyStrategy" : null,
+    "timeout" : 0,
+    "delayTime" : 0,
+    "resourceIds" : null,
+    "createTime" : "2025-04-13 13:16:51",
+    "updateTime" : "2025-04-13 14:18:51",
+    "modifyBy" : null,
+    "taskGroupId" : 0,
+    "taskGroupPriority" : 0,
+    "cpuQuota" : -1,
+    "memoryMax" : -1,
+    "taskExecuteType" : "BATCH",
+    "operator" : 1,
+    "operateTime" : "2025-04-13 14:18:51"
+  } ],
+  "schedule" : {
+    "id" : 4,
+    "workflowDefinitionCode" : 137713880690528,
+    "workflowDefinitionName" : null,
+    "projectName" : null,
+    "definitionDescription" : null,
+    "startTime" : "2025-04-13 00:00:00",
+    "endTime" : "2125-04-13 00:00:00",
+    "timezoneId" : "Asia/Shanghai",
+    "crontab" : "0 2/2 * * * ? *",
+    "failureStrategy" : "CONTINUE",
+    "warningType" : "NONE",
+    "createTime" : "2025-04-13 14:36:04",
+    "updateTime" : "2025-04-13 14:36:07",
+    "userId" : 1,
+    "userName" : null,
+    "releaseState" : "ONLINE",
+    "warningGroupId" : 0,
+    "workflowInstancePriority" : "MEDIUM",
+    "workerGroup" : "default",
+    "tenantCode" : "tenant1",
+    "environmentCode" : -1,
+    "environmentName" : null
+  }
+} ]

Review Comment:
   Keep the blank in the last line.



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -1584,6 +1588,10 @@ protected boolean checkAndImport(User loginUser,
                 putMsg(result, Status.IMPORT_WORKFLOW_DEFINE_ERROR);
                 throw new 
ServiceException(Status.IMPORT_WORKFLOW_DEFINE_ERROR);
             }
+            if (ReleaseState.ONLINE.equals(schedule.getReleaseState())) {
+                Project project = projectMapper.queryByCode(projectCode);
+                schedulerApi.insertOrUpdateScheduleTask(project.getId(), 
schedule);
+            }

Review Comment:
   I think we don't need this since we don't allow to copy the online schedule 
workflow definition. We should keep the same logic.



##########
dolphinscheduler-api/src/test/resources/workflowImport/check_importance_params.json:
##########
@@ -0,0 +1,87 @@
+[ {
+  "workflowDefinition" : {
+    "id" : 1,
+    "code" : 1,
+    "name" : "shell_task",
+    "version" : 2,
+    "releaseState" : "ONLINE",
+    "projectCode" : 1,
+    "description" : "",
+    "globalParams" : "[]",
+    "globalParamList" : [ ],
+    "globalParamMap" : { },
+    "createTime" : "2025-04-13 13:16:51",
+    "updateTime" : "2025-04-13 14:18:51",
+    "flag" : "YES",
+    "userId" : 1,
+    "userName" : null,
+    "projectName" : null,
+    "locations" : "[{\"taskCode\":137713824398176,\"x\":59,\"y\":61}]",
+    "scheduleReleaseState" : null,
+    "schedule" : null,
+    "timeout" : 0,
+    "modifyBy" : null,
+    "warningGroupId" : null,
+    "executionType" : "PARALLEL"
+  },
+  "taskDefinitionList" : [ {
+    "id" : 2,
+    "code" : 1,
+    "name" : "sudo",
+    "version" : 2,
+    "description" : "",
+    "projectCode" : 1,
+    "userId" : 1,
+    "taskType" : "SHELL",
+    "taskParams" : {"localParams":[],"rawScript":"echo 2","resourceList":[]},
+    "taskParamList" : [ ],
+    "taskParamMap" : null,
+    "flag" : "YES",
+    "taskPriority" : "MEDIUM",
+    "userName" : null,
+    "projectName" : null,
+    "workerGroup" : "default",
+    "environmentCode" : -1,
+    "failRetryTimes" : 0,
+    "failRetryInterval" : 1,
+    "timeoutFlag" : "CLOSE",
+    "timeoutNotifyStrategy" : null,
+    "timeout" : 0,
+    "delayTime" : 0,
+    "resourceIds" : null,
+    "createTime" : "2025-04-13 13:16:51",
+    "updateTime" : "2025-04-13 14:18:51",
+    "modifyBy" : null,
+    "taskGroupId" : 0,
+    "taskGroupPriority" : 0,
+    "cpuQuota" : -1,
+    "memoryMax" : -1,
+    "taskExecuteType" : "BATCH",
+    "operator" : 2,
+    "operateTime" : "2025-04-13 14:18:51"
+  } ],
+  "schedule" : {
+    "id" : 4,
+    "workflowDefinitionCode" : 137713880690528,
+    "workflowDefinitionName" : null,
+    "projectName" : null,
+    "definitionDescription" : null,
+    "startTime" : "2025-04-13 00:00:00",
+    "endTime" : "2125-04-13 00:00:00",
+    "timezoneId" : "Asia/Shanghai",
+    "crontab" : "0 2/2 * * * ? *",
+    "failureStrategy" : "CONTINUE",
+    "warningType" : "NONE",
+    "createTime" : "2025-04-13 14:36:04",
+    "updateTime" : "2025-04-13 14:36:07",
+    "userId" : 1,
+    "userName" : null,
+    "releaseState" : "ONLINE",
+    "warningGroupId" : 0,
+    "workflowInstancePriority" : "MEDIUM",
+    "workerGroup" : "default",
+    "tenantCode" : "tenant1",
+    "environmentCode" : -1,
+    "environmentName" : null
+  }
+} ]

Review Comment:
   Keep the blank in the last line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to