You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "JackIllkid (via GitHub)" <gi...@apache.org> on 2024/12/23 08:17:12 UTC

[PR] [fix-16900][api] fix when the copied workflow, the logical node switc… [dolphinscheduler]

JackIllkid opened a new pull request, #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911

   …h loses the flow relationship
   
   <!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
   
   ## Purpose of the pull request
   
   * Fix-16900  [#16900](https://github.com/apache/dolphinscheduler/issues/16900)
   <!--(For example: This pull request adds checkstyle plugin).-->
   
   ## Brief change log
   
   <!--*(for example:)*
   - *Add maven-checkstyle-plugin to root pom.xml*
   -->
   
   ## Verify this pull request
   
   <!--*(Please pick either of the following options)*-->
   
   This pull request is code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added dolphinscheduler-dao tests for end-to-end.*
   - *Added CronUtilsTest to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   (or)
   
   ## Pull Request Notice
   [Pull Request Notice](https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md)
   
   If your pull request contain incompatible change, you should also add it to `docs/docs/en/guide/upgrede/incompatible.md`
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2562222727

   > 您可以运行`mvn spotless:apply`来修复这些违规行为。@JackIllkid
   
   @SbloodyS done, Can you check it again please.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2564594611

   Please retry analysis of this Pull-Request directly on SonarQube Cloud


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2564954837

   Merged into dev, this will be released at 3.3.0, thanks for you PR.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2563571792

   > LGTM, one nit.
   
   good better best


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on code in PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#discussion_r1896997974


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -2122,6 +2124,25 @@ protected void doBatchOperateWorkflowDefinition(User loginUser,
                         long taskCode = CodeGenerateUtils.genCode();
                         taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
                         taskDefinitionLog.setCode(taskCode);
+                        if (TaskTypeUtils.isSwitchTask(taskDefinitionLog.getTaskType())){

Review Comment:
   > Please add some UT.
   
   done



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on code in PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#discussion_r1896298847


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -2122,6 +2124,19 @@ protected void doBatchOperateWorkflowDefinition(User loginUser,
                         long taskCode = CodeGenerateUtils.genCode();
                         taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
                         taskDefinitionLog.setCode(taskCode);
+                        if (TaskTypeUtils.isSwitchTask(taskDefinitionLog.getTaskType())){
+                            final String taskParams = taskDefinitionLog.getTaskParams();
+                            final SwitchParameters switchParameters = JSONUtils.parseObject(taskParams, SwitchParameters.class);
+                            if (switchParameters == null) {
+                                throw new IllegalArgumentException("Switch task params: " + taskParams + " is invalid.");
+                            }
+                            List<SwitchResultVo> dependTaskList = switchParameters.getSwitchResult().getDependTaskList();
+                            dependTaskList.forEach(switchResultVo -> {
+                                switchResultVo.setNextNode(taskCodeMap.get(switchResultVo.getNextNode()));

Review Comment:
   > 我们还需要更改默认分支`SwitchResult`。
   
   done



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "HEEKDragonOne (via GitHub)" <gi...@apache.org>.
HEEKDragonOne commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2561609924

   > > > > 没有处理掉,工作流还是不能复制逻辑节点的关联关系
   > > > 
   > > > 
   > > > Please using english to describe.
   > > 
   > > 
   > > Workflow still cannot copy the association relationship of logical nodes
   > 
   > Hi,what is the version of your dolphinScheduler? I fixed in the dev branch, I will try to upload a gif to prove that the fix was useful. If there is nothing wrong with the gif, then you can see the results after the fix. ![switch-gif-2](https://private-user-images.githubusercontent.com/38174237/398511762-81e6163e-5197-42f4-bf4c-5ffb547e928a.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUxMDIxNTgsIm5iZiI6MTczNTEwMTg1OCwicGF0aCI6Ii8zODE3NDIzNy8zOTg1MTE3NjItODFlNjE2M2UtNTE5Ny00MmY0LWJmNGMtNWZmYjU0N2U5MjhhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI1VDA0NDQxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxZjMyZGVmMjJlOTNkOWZiM2ZlMjIyNTVkMmE1ZjE5YzFhYTM3MDBmNjc4ZDhlNWQ2MDdiMzkxYWE1ZmY4ZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KOS5WYuKHgHIN2ZB4n0
 PlQbDpvftuc7EpHWkgMfdrNg) [ ![switch-gif-2](https://private-user-images.githubusercontent.com/38174237/398511762-81e6163e-5197-42f4-bf4c-5ffb547e928a.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUxMDIxNTgsIm5iZiI6MTczNTEwMTg1OCwicGF0aCI6Ii8zODE3NDIzNy8zOTg1MTE3NjItODFlNjE2M2UtNTE5Ny00MmY0LWJmNGMtNWZmYjU0N2U5MjhhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI1VDA0NDQxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxZjMyZGVmMjJlOTNkOWZiM2ZlMjIyNTVkMmE1ZjE5YzFhYTM3MDBmNjc4ZDhlNWQ2MDdiMzkxYWE1ZmY4ZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KOS5WYuKHgHIN2ZB4n0PlQbDpvftuc7EpHWkgMfdrNg) ](https://private-user-images.githubusercontent.com/38174237/398511762-81e6163e-5197-42f4-bf4c-5ffb547e928a.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIu
 Y29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUxMDIxNTgsIm5iZiI6MTczNTEwMTg1OCwicGF0aCI6Ii8zODE3NDIzNy8zOTg1MTE3NjItODFlNjE2M2UtNTE5Ny00MmY0LWJmNGMtNWZmYjU0N2U5MjhhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI1VDA0NDQxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxZjMyZGVmMjJlOTNkOWZiM2ZlMjIyNTVkMmE1ZjE5YzFhYTM3MDBmNjc4ZDhlNWQ2MDdiMzkxYWE1ZmY4ZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KOS5WYuKHgHIN2ZB4n0PlQbDpvftuc7EpHWkgMfdrNg) [ ](https://private-user-images.githubusercontent.com/38174237/398511762-81e6163e-5197-42f4-bf4c-5ffb547e928a.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzUxMDIxNTgsIm5iZiI6MTczNTEwMTg1OCwicGF0aCI6Ii8zODE3NDIzNy8zOTg1MTE3NjItODFlNjE2M2UtNTE5Ny00MmY0LWJmNGMtNWZmYjU0N2U5MjhhLmdpZj9YLUFte
 i1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjI1VDA0NDQxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxZjMyZGVmMjJlOTNkOWZiM2ZlMjIyNTVkMmE1ZjE5YzFhYTM3MDBmNjc4ZDhlNWQ2MDdiMzkxYWE1ZmY4ZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KOS5WYuKHgHIN2ZB4n0PlQbDpvftuc7EpHWkgMfdrNg)
   
   ok


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2562206294

   You can run `mvn spotless:apply` to fix these violations. @JackIllkid 


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun merged PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "HEEKDragonOne (via GitHub)" <gi...@apache.org>.
HEEKDragonOne commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2561570071

   > > 没有处理掉,工作流还是不能复制逻辑节点的关联关系
   > 
   > Please using english to describe.
   
   Workflow still cannot copy the association relationship of logical nodes


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2563245751

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16911) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [86.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16911&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16911&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16911)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on code in PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#discussion_r1896540840


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -2122,6 +2124,25 @@ protected void doBatchOperateWorkflowDefinition(User loginUser,
                         long taskCode = CodeGenerateUtils.genCode();
                         taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
                         taskDefinitionLog.setCode(taskCode);
+                        if (TaskTypeUtils.isSwitchTask(taskDefinitionLog.getTaskType())){

Review Comment:
   Please add some UT.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "HEEKDragonOne (via GitHub)" <gi...@apache.org>.
HEEKDragonOne commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2560974371

   没有处理掉,工作流还是不能复制逻辑节点的关联关系


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2563573624

   @caishunfeng PTAL


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2564594556

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16911) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [85.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16911&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16911&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16911)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2563522110

   @SbloodyS @ruanwenjun PTAL


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2562200765

   @SbloodyS 
   hi,this is my first time contribut。
   i see the style check did’t pass, should I change the code and commit it again?


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#discussion_r1898420303


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -2122,6 +2124,26 @@ protected void doBatchOperateWorkflowDefinition(User loginUser,
                         long taskCode = CodeGenerateUtils.genCode();
                         taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
                         taskDefinitionLog.setCode(taskCode);
+                        if (TaskTypeUtils.isSwitchTask(taskDefinitionLog.getTaskType())) {
+                            final String taskParams = taskDefinitionLog.getTaskParams();
+                            final SwitchParameters switchParameters =
+                                    JSONUtils.parseObject(taskParams, SwitchParameters.class);
+                            if (switchParameters == null) {
+                                throw new IllegalArgumentException(
+                                        "Switch task params: " + taskParams + " is invalid.");
+                            }
+                            SwitchParameters.SwitchResult switchResult = switchParameters.getSwitchResult();
+                            List<SwitchResultVo> dependTaskList = switchResult.getDependTaskList();
+                            dependTaskList.forEach(switchResultVo -> {
+                                switchResultVo.setNextNode(taskCodeMap.get(switchResultVo.getNextNode()));
+                            });
+                            switchResult.setDependTaskList(dependTaskList);

Review Comment:
   ```suggestion
                               switchResult.getDependTaskList().forEach(switchResultVo -> {
                                   switchResultVo.setNextNode(taskCodeMap.get(switchResultVo.getNextNode()));
                               });
   ```



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "SbloodyS (via GitHub)" <gi...@apache.org>.
SbloodyS commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2561544748

   > 没有处理掉,工作流还是不能复制逻辑节点的关联关系
   
   Please using english to describe.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "HEEKDragonOne (via GitHub)" <gi...@apache.org>.
HEEKDragonOne commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2565053487

   #16934 When copying workflows containing switch nodes, if created in different orders, the associated relationships will also be lost


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2561598141

   > > > 没有处理掉,工作流还是不能复制逻辑节点的关联关系
   > > 
   > > 
   > > Please using english to describe.
   > 
   > Workflow still cannot copy the association relationship of logical nodes
   
   Hi,what is the version of your dolphinScheduler? 
   I fixed in the dev branch, I will try to upload a gif to prove that the fix was useful.
   If there is nothing wrong with the gif, then you can see the results after the fix.
   ![switch-gif-2](https://github.com/user-attachments/assets/81e6163e-5197-42f4-bf4c-5ffb547e928a)
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2563298592

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16911) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=16911&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [86.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16911&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=16911&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=16911)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#discussion_r1895487442


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -2122,6 +2124,19 @@ protected void doBatchOperateWorkflowDefinition(User loginUser,
                         long taskCode = CodeGenerateUtils.genCode();
                         taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
                         taskDefinitionLog.setCode(taskCode);
+                        if (TaskTypeUtils.isSwitchTask(taskDefinitionLog.getTaskType())){
+                            final String taskParams = taskDefinitionLog.getTaskParams();
+                            final SwitchParameters switchParameters = JSONUtils.parseObject(taskParams, SwitchParameters.class);
+                            if (switchParameters == null) {
+                                throw new IllegalArgumentException("Switch task params: " + taskParams + " is invalid.");
+                            }
+                            List<SwitchResultVo> dependTaskList = switchParameters.getSwitchResult().getDependTaskList();
+                            dependTaskList.forEach(switchResultVo -> {
+                                switchResultVo.setNextNode(taskCodeMap.get(switchResultVo.getNextNode()));

Review Comment:
   We also need to change the default branch in `SwitchResult`.



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#issuecomment-2564954703

   Awesome work, congrats on your first merged pull request!
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-16900][api] fix when the copied workflow, the logical node switch loses the flow relationship [dolphinscheduler]

Posted by "JackIllkid (via GitHub)" <gi...@apache.org>.
JackIllkid commented on code in PR #16911:
URL: https://github.com/apache/dolphinscheduler/pull/16911#discussion_r1896572653


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -2122,6 +2124,25 @@ protected void doBatchOperateWorkflowDefinition(User loginUser,
                         long taskCode = CodeGenerateUtils.genCode();
                         taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
                         taskDefinitionLog.setCode(taskCode);
+                        if (TaskTypeUtils.isSwitchTask(taskDefinitionLog.getTaskType())){

Review Comment:
   > 请添加一些 UT。
   
   👌,I will create the Test



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org