-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
batch copy or move process #2753 #2884
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #2884 +/- ##
============================================
+ Coverage 34.15% 34.22% +0.07%
- Complexity 2422 2434 +12
============================================
Files 443 443
Lines 20637 20720 +83
Branches 2531 2544 +13
============================================
+ Hits 7049 7092 +43
- Misses 12926 12957 +31
- Partials 662 671 +9
Continue to review full report at Codecov.
|
Please solve ut |
...pi/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
Outdated
Show resolved
Hide resolved
...pi/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
Outdated
Show resolved
Hide resolved
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
Outdated
Show resolved
Hide resolved
...uler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Outdated
Show resolved
Hide resolved
...uler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Outdated
Show resolved
Hide resolved
...uler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Outdated
Show resolved
Hide resolved
|
@zixi0825 I think Rubik-W has already gave some good suggestions, can you reply to him ? |
to 1 : I will add the instance linkage after move workflow |
…duler into batch_copy_or_move_process
String projectName, | ||
String processDefinitionIds, | ||
int targetProjectId, boolean isCopy){ | ||
Map<String, Object> result = new HashMap<>(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hashmap does not recommend the initial value odd,No need to initialize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial value of HashMap in all Controller and Service in DolphinScheduler is 5, so if you want to modify it, then it is best to unify all changes after discussion
————————————————————————————————————————————
在DolphinScheduler中所有的Controller和Service中HashMap的初始值都为5,所以如果要修改的话,那么最好经过讨论以后,统一全部修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was discussed before, you can send an email and change it in a unified way
这个之前讨论过,你可以发个邮件,统一改了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
...uler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
Outdated
Show resolved
Hide resolved
...uler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Outdated
Show resolved
Hide resolved
...-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
Outdated
Show resolved
Hide resolved
Map<String, Object> copyProcessDefinitionResult = | ||
copyProcessDefinition(loginUser,Integer.valueOf(processDefinitionId),targetProject); | ||
if (!Status.SUCCESS.equals(copyProcessDefinitionResult.get(Constants.STATUS))) { | ||
failedIdList.add((String) copyProcessDefinitionResult.get(Constants.MSG)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think failedIdList should store the id, but there added may be a failed description statement not the id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, simply returning the id does not fully express the reason for the failure, I designed it to return a more complete cause of the error
在我看来,仅仅返回id并不能完全表达失败的原因,我这么设计是为了返回更加完整的错误原因
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two questions:
1 Follow your current design. There may be a splicing return. Part of the error description and part of the id situation are not clear.
2 I think that the id should not be returned here, the process name should be returned, and the front end should be prompted, which of the several process errors is ok. If the id is returned, the front-end operator does not understand which process problem these id refers to
我有两点疑问,
1 按照你现在设计。有可能会出现拼接返回 一部分是错误描述,一部分是id情况 ,这样描述不清晰了。
2 我觉得这里不应该返回id,应该返回流程名称。给前端提示,哪个几个流程错误就ok了,如果返回id,前端操作人员也不理解这些id指的是哪个流程问题。你觉得了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it to the name of the workflow that returned the error. If the error information is returned, it cannot be ruled out that the information is incomplete
我已经将其修改为返回出错的工作流名称了,返回错误描述的话确实不能排除信息不完整的情况
例子:如果工作流不存在的话,返回的信息如下:
从project_test1复制工作流到project_test1错误 : 47[null]
@@ -43,7 +43,7 @@ | |||
*HttpTask./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify note description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes no sense, I changed it back
@ApiException(QUERY_USER_CREATED_PROJECT_ERROR) | ||
public Result queryProjectCreatedByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) { | ||
logger.info("login user {}, query authorized project by user id: {}.", StringUtils.replaceNRTtoUnderline(loginUser.getUserName()), StringUtils.replaceNRTtoUnderline(String.valueOf(loginUser.getId()))); | ||
Map<String, Object> result = projectService.queryProjectCreatedByUser(loginUser, loginUser.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryProjectCreatedByUser can define a parameter, you can not userid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this function design is to get the project created by the logged-in user, so I think there is no problem using userid
————————————————————————————————————————————————————
这个函数设计的目的就是获取登录用户所创建的项目,所以我认为使用userid没有问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryProjectCreatedByUser 方法其实传loginUser 值就可以了啊。在方法里面直接loginUser.getId() 获取userid。不影响功能啊。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/BaseService.java
Outdated
Show resolved
Hide resolved
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/BaseService.java
Outdated
Show resolved
Hide resolved
...uler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Outdated
Show resolved
Hide resolved
}) | ||
@PostMapping(value = "/copy") | ||
@PostMapping(value = "/copy-or-move") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Will it be better to split copy and move to two api for single responsibility?
...pi/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
Outdated
Show resolved
Hide resolved
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, | ||
@RequestParam("processId") Integer processId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the changes about blank, thx a lot, it is suggested to add the blank according to the checkstyle.xml, you can configure the checkstyle.xml[1] to your ide.
[1] https://github.com/apache/incubator-dolphinscheduler/blob/dev/style/checkstyle.xml
…duler into batch_copy_or_move_process
…825/incubator-dolphinscheduler into batch_copy_or_move_process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
good job
please one PR solve one issue next time, thx
Hi , @samz406 @yangyichao-mango , could this PR be merged? |
I think split copy and move to two api will be better, but at present it LGTM, we can improve it later. |
i will split it next week |
@yangyichao-mango @zixi0825 split in this PR? |
yes |
@zixi0825 Please resolve the conflicting files, then PR can be merged |
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
What is the purpose of the pull request
This pull request adds batch copy or move process feature backend code #2753
Brief change log
Verify this pull request