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

Fix flytectl returning the oldest workflow when using --latest flag #5716

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

RRap0so
Copy link
Contributor

@RRap0so RRap0so commented Sep 2, 2024

Tracking issue

Closes #3972

Why are the changes needed?

Passing the --latest flag in when getting Workflows are not returning the latest but the opposite.

What changes were proposed in this pull request?

We set a default filter for the get FetchWorkflowLatestVersion and also FetchLaunchPlanLatestVersion.

How was this patch tested?

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 12 lines in your changes missing coverage. Please review.

Project coverage is 36.17%. Comparing base (96c799c) to head (dff21ab).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...tectl/pkg/ext/mocks/admin_fetcher_ext_interface.go 25.00% 8 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5716   +/-   ##
=======================================
  Coverage   36.16%   36.17%           
=======================================
  Files        1303     1303           
  Lines      109661   109676   +15     
=======================================
+ Hits        39664    39673    +9     
- Misses      65852    65858    +6     
  Partials     4145     4145           
Flag Coverage Δ
unittests-datacatalog 51.37% <ø> (ø)
unittests-flyteadmin 55.25% <ø> (-0.04%) ⬇️
unittests-flytecopilot 12.17% <ø> (ø)
unittests-flytectl 62.21% <57.14%> (+0.04%) ⬆️
unittests-flyteidl 7.12% <ø> (ø)
unittests-flyteplugins 53.36% <ø> (+0.01%) ⬆️
unittests-flytepropeller 41.76% <ø> (ø)
unittests-flytestdlib 55.35% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Rafael Raposo <[email protected]>
Signed-off-by: Rafael Raposo <[email protected]>
@RRap0so RRap0so force-pushed the rafaelraposo/fix-flytectl-latest branch from d282732 to 53fe925 Compare September 2, 2024 15:54
Signed-off-by: Rafael Raposo <[email protected]>
Signed-off-by: Rafael Raposo <[email protected]>
filter := filters.Filters{
SortBy: "created_at",
Limit: 1,
Asc: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure if I need to specify Asc but better safe than sorry.

Copy link
Contributor

Choose a reason for hiding this comment

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

better be explicit yeah

@RRap0so RRap0so marked this pull request as ready for review September 3, 2024 06:01
@RRap0so RRap0so changed the title wip Fix flytectl returning the oldest workflow when using --latest flag Sep 3, 2024
@@ -55,7 +55,7 @@ type AdminFetcherExtInterface interface {
FetchAllVerOfWorkflow(ctx context.Context, name, project, domain string, filter filters.Filters) ([]*admin.Workflow, error)

// FetchWorkflowLatestVersion fetches latest version of workflow in a project, domain
FetchWorkflowLatestVersion(ctx context.Context, name, project, domain string, filter filters.Filters) (*admin.Workflow, error)
FetchWorkflowLatestVersion(ctx context.Context, name, project, domain string) (*admin.Workflow, error)
Copy link
Member

Choose a reason for hiding this comment

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

Should we keep the filter here? What if I want to fetch the latest workflow with a specific tag?

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 better to remove it actually, it's clearer in what it's doing, and merging filters behind the scenes seems weird to me.

Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

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

@RRap0so thanks for closing out a stale issue! you tested this locally against some running backend right? good to go if so.

filter := filters.Filters{
SortBy: "created_at",
Limit: 1,
Asc: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

better be explicit yeah

@@ -55,7 +55,7 @@ type AdminFetcherExtInterface interface {
FetchAllVerOfWorkflow(ctx context.Context, name, project, domain string, filter filters.Filters) ([]*admin.Workflow, error)

// FetchWorkflowLatestVersion fetches latest version of workflow in a project, domain
FetchWorkflowLatestVersion(ctx context.Context, name, project, domain string, filter filters.Filters) (*admin.Workflow, error)
FetchWorkflowLatestVersion(ctx context.Context, name, project, domain string) (*admin.Workflow, error)
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 better to remove it actually, it's clearer in what it's doing, and merging filters behind the scenes seems weird to me.

@RRap0so
Copy link
Contributor Author

RRap0so commented Sep 9, 2024

@wild-endeavor I've tested it all. Going to go ahead and merge :)

@RRap0so RRap0so merged commit 89efcc6 into flyteorg:master Sep 9, 2024
53 checks passed
@RRap0so RRap0so deleted the rafaelraposo/fix-flytectl-latest branch September 9, 2024 09:30
@eapolinario
Copy link
Contributor

eapolinario commented Sep 9, 2024

@RRap0so , released in flytectl v0.9.2.

bgedik pushed a commit to bgedik/flyte that referenced this pull request Sep 12, 2024
…lyteorg#5716)

* Fix flytectl returning the oldest workflow when using --latest flag (flyteorg#5716)

Signed-off-by: Rafael Raposo <[email protected]>
Signed-off-by: Bugra Gedik <[email protected]>
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.

[BUG] Flytectl returns the oldest workflow version when using --latest flag
4 participants