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
feat(controller): Support any() and all() for TaskGroup in depends logic. Closes #3405 #3964
feat(controller): Support any() and all() for TaskGroup in depends logic. Closes #3405 #3964
Conversation
FYI @simster7 |
Thanks, will take a look at this over the coming days |
Just a little nudge @simster7 ;) |
Hi @mark9white, thanks for the nudge and sorry for the delay. I'll take a look today |
Hey @mark9white. Thanks for submitting this change and sorry for the delay. We agreed to support this feature, but we want to consider a different syntax. Having We want to experiment a bit with possible syntaxes. Ideas that came around include:
Thoughts? |
Thanks for taking a look. I think dedicated boolean attributes as you suggest, eg task.AnySucceeded, would be easiest for the users to understand and use. I could change the PR implementation to that? |
Sure sounds good. I'm thinking that we only need to have
What do you think? Are there any more than we might need? |
I think if we want to minimise the surface area then However if we want to provide full flexibility then I would add all the permutations. For example, it's not exactly possible to calculated all failed as you suggest - eg the case where one was skipped, one failed and none succeeded. And having a direct |
Sure let's start with |
@mark9white let me know if you need any help with this. |
@alexec Thanks, I should be able to get to it in a couple of weeks .. |
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.
Changes requested
f89abcd
to
5ae3db2
Compare
5ae3db2
to
ac6a722
Compare
Makefile
Outdated
@@ -47,7 +47,7 @@ CONTROLLER_IMAGE_FILE := dist/controller-image.marker | |||
|
|||
# perform static compilation | |||
STATIC_BUILD ?= true | |||
STATIC_FILES ?= true | |||
STATIC_FILES ?= false |
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.
revert this
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.
Done
ac6a722
to
ba7a33c
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.
Gave this a very quick first pass
workflow/common/ancestry.go
Outdated
type DependencyType int | ||
|
||
const ( | ||
TaskDependency DependencyType = 0 |
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.
TaskDependency DependencyType = 0 | |
DependencyTypeTaskDependency DependencyType = iota |
See: https://yourbasic.org/golang/iota/
Only needed for the first item
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.
👍
workflow/common/ancestry.go
Outdated
for _, matchGroup := range matches { | ||
// We have matched a taskName.TaskResult | ||
if matchGroup[2] != -1 { | ||
match := depends[matchGroup[2]:matchGroup[3]] | ||
split := strings.Split(match, ".") | ||
dependencies[split[0]] = true | ||
if split[1] == "AnySucceeded" || split[1] == "AllFailed" { |
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.
Why use raw strings instead of our const
variables?
workflow/controller/dag.go
Outdated
@@ -44,7 +44,7 @@ type dagContext struct { | |||
|
|||
// dependencies is a list of all the tasks a specific task depends on. Because dependencies are computed using regex | |||
// and regex is expensive, we cache the results so that they are only computed once per operation | |||
dependencies map[string][]string | |||
dependencies map[string]map[string]common.DependencyType |
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'm almost surely wrong, but I didn't see a place where we actually use the value of the inner map (i.e. common.DependencyType
). Can you explain why it's necessary, point me where it's used?
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 issue is that dagValidationContext needs the inner map, and was getting passed in as a dagContext, so I modified dagContext to keep them matching. This wasn't ideal, I've fixed it up.
be79772
to
c6fc802
Compare
I don't think the build failure is related to my change. |
5ebd1bb
to
4bd2e0e
Compare
@simster7 do you have anymore feedback on this please? |
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.
Sorry for the delay. This LGTM, I just want @jessesuen to approve of the syntax. I will bring this up with him tomorrow
@markterm Can you merger/rebase this with master please? |
… depends logic. Closes argoproj#3405 Signed-off-by: Mark White <mark@markwhite.com>
454d38d
to
a9517af
Compare
@simster7 done |
@markterm Could you check this box? This way we can merge this branch with master on our own to merge it faster |
I don't have that option, so I've given access to the repo which will hopefully have the same effect. I've also triggered a branch update with master. |
If a DAG task depends on a task that uses withItems, then can depend on any or all of the children being in a status.
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.