-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: Filter workflows by "Finished before" and "Created Since" via API. Fixes #13151 #13962
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Adrien Delannoy <[email protected]>
Signed-off-by: Adrien Delannoy <[email protected]>
Signed-off-by: Adrien Delannoy <[email protected]>
68410e6
to
1d278eb
Compare
The CLI is one of the most straightforward parts of the codebase (simpler than the UI and API, IMO, so should be easier than the parts you've already went through!); each command has a file (e.g. You can see the existing client-side date filters in the argo-workflows/cmd/argo/commands/list.go Lines 184 to 209 in 97b94f0
Similar to the UI changes, those should be changed to be passed to the API instead of running client-side. The API call is made a few lines above in this block: argo-workflows/cmd/argo/commands/list.go Lines 166 to 170 in 97b94f0
|
@@ -45,7 +45,7 @@ func (w *archivedWorkflowServer) ListArchivedWorkflows(ctx context.Context, req | |||
listOptions = *req.ListOptions | |||
} | |||
|
|||
options, err := sutils.BuildListOptions(listOptions, req.Namespace, req.NamePrefix, "") | |||
options, err := sutils.BuildListOptions(listOptions, req.Namespace, req.NamePrefix, "", "", "") |
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 should work on archived workflows too -- per #13151 (comment), no longer having a server-side date filter available in the archived UI is the regression at the core of the issue (that stems from 3.5's archived/live UI unification / #11121).
that half is actually a fix to a 3.5 regression, not a feature (as the feature was unintentionally partially removed in 3.5. the other half that adds it for live workflows via the SQLiteDB is a new feature; though as filtering on both is now required, that can be seen as a prereq for the fix)
Note that there is existing SQL code for minStartedAt
and maxStartedAt
, which were used before #11840, that could be re-used (renaming in the API might be breaking though if they were exposed before?)
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.
Indeed I missed that part for archived workflows, I'll change that and add tests.
For minStartedAt
and maxStartedAt
I didn't used those because I wasn't sure if they were still used somehow, and because they are not based on the same attribute so the query will be different. I can rename in the API if you tell me it's safe.
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 tried to update the code like this, but it seems that createdAfter
and finishedBefore
have no effect, not sure they are passed down to the API call. I spent few time trying to understand what's going on, do you have any idea ? I must miss something
var workflows wfv1.Workflows
createdAfter := ""
finishedBefore := ""
if flags.createdSince != "" {
createdTime, err := argotime.ParseSince(flags.createdSince)
if err != nil {
return nil, err
}
createdAfter = createdTime.Format(time.RFC3339)
}
if flags.finishedBefore != "" {
finishedTime, err := argotime.ParseSince(flags.createdSince)
if err != nil {
return nil, err
}
finishedBefore = finishedTime.Format(time.RFC3339)
}
for {
log.WithField("listOpts", listOpts).Debug()
wfList, err := serviceClient.ListWorkflows(ctx, &workflowpkg.WorkflowListRequest{
Namespace: flags.namespace,
ListOptions: listOpts,
Fields: flags.displayFields(),
CreatedAfter: createdAfter,
FinishedBefore: finishedBefore,
})
if err != nil {
return nil, err
}
workflows = append(workflows, wfList.Items...)
if wfList.Continue == "" {
break
}
listOpts.Continue = wfList.Continue
}
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.
@tooptoop4 what would be the best ? I'm a bit stuck with the CLI..!
Can we split this in another issue for later so we can merge this work already ?
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'll want to test when both are set simultaneously as well since there are some edge cases with that, although now that these are in the API, that can be covered with back-end tests (i.e. instead of manual testing) and ensure that with and without archived workflows works correctly |
@agilgur5 join the band again 🎸 |
My original rationale and the original problems therein have not changed, so that won't happen, but if I'm tagged somewhere (as I was here) and it's related to something I wrote, I do try to be helpful as a general principle. |
Fixes #13151
Motivation
Modifications
createdAfter
andfinishedBefore
on server side similarly to UI: 3.5 missing name + name prefix filters for archived workflows #12161.createdAfter
is based onmetadata.creationTimestamp
which is stored as json so I needed to extract it is the request hereVerification
ListWokflows
function