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

Reference task to fetch latest version by default #5895

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

featherchen
Copy link

@featherchen featherchen commented Oct 23, 2024

Tracking issue

Related to #5825

Why are the changes needed?

When task version is not specified (i.e. ""), we should return the latest one when getTask is called

What changes were proposed in this pull request?

When the version is "", we fetch DB directly to get the latest task.
Also remove the UT that check whether version is empty, since this situation is allowed now.

How was this patch tested?

By unit test (testGetTask)

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

welcome bot commented Oct 23, 2024

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@featherchen featherchen marked this pull request as draft October 23, 2024 09:44
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 90.62500% with 3 lines in your changes missing coverage. Please review.

Project coverage is 36.86%. Comparing base (fef67b8) to head (fb6f97d).
Report is 43 commits behind head on master.

Files with missing lines Patch % Lines
...yteadmin/pkg/manager/impl/validation/validation.go 82.35% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5895   +/-   ##
=======================================
  Coverage   36.85%   36.86%           
=======================================
  Files        1310     1310           
  Lines      131246   131270   +24     
=======================================
+ Hits        48377    48395   +18     
- Misses      78670    78676    +6     
  Partials     4199     4199           
Flag Coverage Δ
unittests-datacatalog 51.58% <ø> (ø)
unittests-flyteadmin 54.06% <90.62%> (+<0.01%) ⬆️
unittests-flytecopilot 11.73% <ø> (ø)
unittests-flytectl 62.39% <ø> (ø)
unittests-flyteidl 6.92% <ø> (ø)
unittests-flyteplugins 53.84% <ø> (ø)
unittests-flytepropeller 42.90% <ø> (ø)
unittests-flytestdlib 55.42% <ø> (+0.05%) ⬆️

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.

@eapolinario
Copy link
Contributor

TesGetTask is failing, can you take a look?

@featherchen
Copy link
Author

@eapolinario TestGetTask should work now, thanks @troychiu for the fix.

@featherchen featherchen force-pushed the issue-5825 branch 6 times, most recently from 35f91cc to 7ff7fdc Compare November 8, 2024 05:18
@featherchen featherchen marked this pull request as ready for review November 8, 2024 05:30
@featherchen featherchen changed the title [WIP] Reference task to fetch latest version by default Reference task to fetch latest version by default Nov 8, 2024
@featherchen
Copy link
Author

@troychiu Can you help me review this PR? Thanks.

}).Take(&task)
var tx *gorm.DB
if input.Version == "" {
tx = r.db.WithContext(ctx).Where(`"tasks"."project" = ? AND "tasks"."domain" = ? AND "tasks"."name" = ?`, input.Project, input.Domain, input.Name).Limit(1)
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, are we able to use TaskKey here?

models.TaskKey{
  Project: input.Project,
  Domain:  input.Domain,
  Name:    input.Name,
}

var tx *gorm.DB
if input.Version == "" {
tx = r.db.WithContext(ctx).Where(`"tasks"."project" = ? AND "tasks"."domain" = ? AND "tasks"."name" = ?`, input.Project, input.Domain, input.Name).Limit(1)
tx = tx.Order(`"tasks"."version" DESC`)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we order by version instead of time information such as created_at?

@@ -45,6 +45,37 @@ var taskExecutionIdentifier = &core.TaskExecutionIdentifier{
RetryAttempt: 1,
}

func TestGetTaskExecutions(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we register more than one tasks and see if we get the latest one?

@Future-Outlier
Copy link
Member

Future-Outlier commented Dec 2, 2024

cc @featherchen any updates?

Copy link
Member

@Future-Outlier Future-Outlier left a comment

Choose a reason for hiding this comment

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

let's wait for the update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Approved yet unmerged PRs
Status: In progress
Development

Successfully merging this pull request may close these issues.

5 participants