Skip to content
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

Merged
merged 54 commits into from
Aug 13, 2020
Merged

batch copy or move process #2753 #2884

merged 54 commits into from
Aug 13, 2020

Conversation

zixi0825
Copy link
Member

@zixi0825 zixi0825 commented Jun 3, 2020

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

@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2020

Codecov Report

Merging #2884 into dev will increase coverage by 0.07%.
The diff coverage is 66.85%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ Complexity Δ
...scheduler/api/controller/AlertGroupController.java 5.26% <0.00%> (ø) 2.00 <0.00> (ø)
...uler/api/controller/ProcessInstanceController.java 4.00% <0.00%> (ø) 2.00 <0.00> (ø)
...hinscheduler/api/controller/ProjectController.java 5.88% <0.00%> (-0.57%) 2.00 <0.00> (ø)
...olphinscheduler/api/service/DataSourceService.java 0.61% <0.00%> (ø) 2.00 <0.00> (ø)
...dolphinscheduler/api/service/SchedulerService.java 24.78% <0.00%> (ø) 13.00 <0.00> (ø)
...che/dolphinscheduler/common/utils/StringUtils.java 75.00% <0.00%> (-10.72%) 10.00 <0.00> (ø)
...e/dolphinscheduler/api/service/MonitorService.java 13.63% <25.00%> (ø) 2.00 <1.00> (ø)
.../dolphinscheduler/api/service/ExecutorService.java 33.90% <33.33%> (ø) 19.00 <4.00> (ø)
...cheduler/api/service/ProcessDefinitionService.java 59.71% <53.75%> (-1.16%) 85.00 <34.00> (+10.00) ⬇️
...phinscheduler/api/service/DataAnalysisService.java 59.75% <75.00%> (ø) 14.00 <9.00> (ø)
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b54c76...a4428dd. Read the comment docs.

@break60
Copy link
Contributor

break60 commented Jun 10, 2020

Please solve ut

@wen-hemin
Copy link
Contributor

  1. After confirming the move workflow, does the modification on the workflow instance list page have an impact?
  2. Confirm there are no file changes on the front-end page ?

@gabrywu
Copy link
Member

gabrywu commented Jun 13, 2020

@zixi0825 I think Rubik-W has already gave some good suggestions, can you reply to him ?

@zixi0825
Copy link
Member Author

  1. After confirming the move workflow, does the modification on the workflow instance list page have an impact?
  2. Confirm there are no file changes on the front-end page ?

to 1 : I will add the instance linkage after move workflow
to 2:The modification of the front-end will be completed by @break60

String projectName,
String processDefinitionIds,
int targetProjectId, boolean isCopy){
Map<String, Object> result = new HashMap<>(5);
Copy link
Contributor

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

Copy link
Member Author

@zixi0825 zixi0825 Jun 24, 2020

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,所以如果要修改的话,那么最好经过讨论以后,统一全部修改

Copy link
Contributor

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
这个之前讨论过,你可以发个邮件,统一改了

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK!

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));
Copy link
Contributor

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

Copy link
Member Author

@zixi0825 zixi0825 Jun 24, 2020

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并不能完全表达失败的原因,我这么设计是为了返回更加完整的错误原因

Copy link
Contributor

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指的是哪个流程问题。你觉得了

Copy link
Member Author

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./
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify note description

Copy link
Member Author

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());
Copy link
Contributor

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

Copy link
Member Author

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没有问题

Copy link
Contributor

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。不影响功能啊。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right

@wen-hemin wen-hemin self-requested a review July 28, 2020 06:21
})
@PostMapping(value = "/copy")
@PostMapping(value = "/copy-or-move")
Copy link
Contributor

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?

Comment on lines 246 to 247
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processId") Integer processId
Copy link
Contributor

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

Copy link
Contributor

@davidzollo davidzollo left a 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

@gabrywu
Copy link
Member

gabrywu commented Aug 7, 2020

Hi , @samz406 @yangyichao-mango , could this PR be merged?

@yangyichao-mango
Copy link
Contributor

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.

@zixi0825
Copy link
Member Author

zixi0825 commented Aug 7, 2020

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

@gabrywu
Copy link
Member

gabrywu commented Aug 10, 2020

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?

@zixi0825
Copy link
Member Author

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

@gabrywu
Copy link
Member

gabrywu commented Aug 11, 2020

@zixi0825 Please resolve the conflicting files, then PR can be merged

@sonarcloud
Copy link

sonarcloud bot commented Aug 11, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 6 Code Smells

67.9% 67.9% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@yangyichao-mango yangyichao-mango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@davidzollo davidzollo added this to the 1.4.0 milestone Aug 13, 2020
@davidzollo davidzollo merged commit 46ab86d into apache:dev Aug 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants