-
Notifications
You must be signed in to change notification settings - Fork 499
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
refactor: add subtask register #4896
refactor: add subtask register #4896
Conversation
@chenggui53 Thanks for your contribution. |
@klesh Yes, so when I registered subtask with init, I added pre-dependencies declaration and queued the results when fetching the list in backend/plugins/gitlab/impl/impl.go, which was tested in the order defined by the previous code. At the same time, this part will only be called when the plugin is initialized, the ordering will not affect the performance, and can reduce the problems caused by the wrong order of the plugins or the plugins are not registered. |
@klesh In the short time I've been using the gitlab plugin, I've found some problems caused by manually filling in subtasks (once a specific subtask not being added to the list and not taking effect after being declared in the advanced configuration, and once a subtask being added repeatedly), I think it's worth taking some time to solve it systematically. If Gitlab's plugin registration can be well optimized, the relevant code can also be used in plugins with more subtasks such as GitHub, reducing the possibility of problems. |
6b12b65
to
4067987
Compare
@chenggui53 Aah, you are right, sorry for missing the point. |
46af817
to
bcb74d3
Compare
func init() { | ||
register(SubTaskMetaRegister{ | ||
Plugin: &CollectTagMeta, | ||
Dependencies: []string{ExtractApiMergeRequestDetailsMeta.Name}, |
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.
looks like Dependencies is always just going to be a single subtask? Is there a reason for this to be a slice?
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.
As it stands, we only need to specify a dependent subtask, but if it has dependencies on the results of several subtasks when creating a new subtask, then slice will be useful
not sure if we need this kind of mechanism, if so, is it appropriate to sit it on the task level (organize subtasks in a plugin only), or should we do it on the framework level (organize tasks and their subtasks across all plugins). I would like to hear your thoughts on this. |
@klesh I personally think that this registration mechanism should be used at the framework level, but since I am not sure whether this change will be accepted, I only modified the gitlab plugin that I use a lot first. If needed, I can change this to the framework level and adapt it to other plugins. |
3d2acb9
to
4857973
Compare
It is currently the responsibility of the plugin to order its subtasks while taking into account their dependencies. Declaring those dependencies might also be a first step to enable other improvements.
Adding dependency declaration at the subtask level does not solves all those point but is a step in the good direction IMO. Now regarding implementation, I find SubtaskMeta to be a better place to declare those dependencies than to call a register function in For how to express dependencies, I think we should not force to declare that a subtask depends on another specific subtask but instead declare that the task require that some type of entity has been collected. I agree that it poses no problem for dependencies between subtasks defined by the same plugin: an extractor will always depend on the same convertor for example. But this doesn't work for dependencies between subtasks from different different plugins. For example, the DORA plugin requires some data to be present, like CICDPipelineCommit or PullRequest, but doesn't and mustn't care which plugin collected that data. So the declaration of dependencies should say "I need pull requests" not "I depend on gitlab plugin". I think that declaring dependencies that way would allow us to simplify plugin code and the plugin model of the framework. To sum up, here is what I think we sould do:
|
@CamilleTeruel Thank you very much for your guidance, as I am not particularly familiar with many aspects of devlake, and after reading your instructions, I feel very helpful and I will refer to your instructions to optimize these a bit, which may take some time. |
Great discussion, thanks to @CamilleTeruel @chenggui53
|
4857973
to
f85c4f7
Compare
3dfba8a
to
b08cad9
Compare
aee16ee
to
aaa5521
Compare
aaa5521
to
48d6413
Compare
Looking good! Good job. Is it ready yet? |
hi @klesh, sorry for taking so long, can you help to review this pr when you have time? It mainly includes the following content (to avoid a large number of modifications in each plugin, first only modify the gitlab plugin, and then apply it to other plugins after the code is ok) in backend/core
in backend/plugin
In backend/plugins/gitlab, take gitlab as an example
|
@chenggui53 Nice job, will do |
7f28107
to
97eb8ed
Compare
hi @klesh I‘ve fix some workflow errors, can you help trigger workflow again ? |
c8a6b6d
to
92b28b4
Compare
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.
@chenggui53 Very impressive work 👍👍👍. Would you mind resolving some minor issues?🙏
48b0849
to
93fdc93
Compare
c988df0
to
1548893
Compare
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
@chenggui53 Thanks for your contribution, it has been a pleasure working with you. |
@klesh Me too, and I really appreciate your guidance :). Do you think it's time to apply this register to other plugins, or I should create a new pr to do that? |
pr-type/bug-fix
,pr-type/feature-development
, etc.Summary
This PR addresses the issue of subtask registration in our GitLab plugin. Previously, subtasks had to be manually specified in a particular order, which was error-prone and time-consuming. To solve this problem, I added a register and dependency sorter that automatically register and orders subtasks based on their dependencies.
Does this close any open issues?
Closes #4413
Screenshots
Include any relevant screenshots here.
Other Information
Any other information that is important to this PR.