-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
refactoring PipelineRunState to simplify logic for retrieving next tasks #3254
Conversation
/kind cleanup |
The following is the coverage report on the affected files.
|
bf93ec5
to
f61ded3
Compare
The following is the coverage report on the affected files.
|
Adding a new function |
Introducing PipelineRunFacts as a combination of PipelineRunState, DAG Graph, and finally Graph. This simplifies function definitions without having to pass graphs to PipelineRunState attributes.
f61ded3
to
f412b11
Compare
The following is the coverage report on the affected files.
|
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.
thank you for this much-needed refactor @pritidesai 😀
type PipelineRunFacts struct { | ||
State PipelineRunState | ||
TasksGraph *dag.Graph | ||
FinalTasksGraph *dag.Graph | ||
} | ||
|
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.
Given that PipelineRunState
is a list of ResolvedPipelineRunTask
...
type PipelineRunState []*ResolvedPipelineRunTask |
...I was wondering if we could make that explicit by calling it ResolvedPipelineRunTasks
then we can call this object PipelineRunState
instead of PipelineRunFacts
, what do you think?
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.
@jerop I like it but given ResolvedPipelineRunTask
is so long and differentiating it with the slice of ResolvedPipelineRunTask
by just additional s
might confuse readers.
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.
we could rename ResolvedPipelineRunTask
to ResolvedPipelineTask
? 😜
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.
yes yes, I like that especially given that we refer to it as PipelineTask instead of PipelineRunTask
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.
thanks @jerop, will have that renaming going in a separate PR. Once this is merged, would like to get the refactoring of GetPipelineConditionStatus
in 🙏
This is the refactoring to simplify retrieving execution queue with DAG tasks, DAG tasks with when expressions, and finally tasks with minimal code changes. These changes in turn simplify GetPipelineConditionStatus. |
Got it, thank you! Combining PipelineRunState, DAG Graph, and finally Graph is the approach I was pursuing on #2821, but in my PR I did that in a different module, because the main goal there was to move handling of the DAG away from |
thanks @afrittoli yes would be great to slowly get to the point where its easy to implement and review new functionalities to the existing scheduling (one very exciting near term feature coming in from @jerop as part of |
@@ -137,29 +132,53 @@ func (state PipelineRunState) checkTasksDone(d *dag.Graph) bool { | |||
return true | |||
} | |||
|
|||
func (facts *PipelineRunFacts) CheckDAGTasksDone() bool { |
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.
nit: these three public funcs could use comments. Could be helpful for new devs not yet familiar with the distinction between Tasks and FinalTasks
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbwsg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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
Changes
Introducing
PipelineRunFacts
as a combination ofPipelineRunState
, DAG Graph, and finally Graph. This simplifies function definitions inpipelinerun.go
without having to pass graphs around.This simplifies our implementation of retrieving next tasks, which will be further simplified in a separate PR if we decide to go this route. Also, this new
struct
would help simplifyGetPipelineConditionStatus
a whole lot (in a follow up PR)./cc @bobcatfish
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes