Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

More data in workflow exists err msg #2522 #487

Merged
merged 6 commits into from
Oct 28, 2022
Merged

More data in workflow exists err msg #2522 #487

merged 6 commits into from
Oct 28, 2022

Conversation

jerempy
Copy link
Contributor

@jerempy jerempy commented Oct 13, 2022

Return more data if workflow already exists with different structure. Will have another PR in the python flytekit to compare the values. Flytekit PR: flyteorg/flytekit#1235

TL;DR

More data in err message for #2522

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

How did you fix the bug, make the feature etc. Link to any design docs etc

Tracking Issue

Fixes flyteorg/flyte#2522

Follow-up issue

NA
OR
https://github.com/flyteorg/flyte/issues/

@welcome
Copy link

welcome bot commented Oct 13, 2022

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).

EngHabu
EngHabu previously approved these changes Oct 14, 2022
@EngHabu
Copy link
Contributor

EngHabu commented Oct 14, 2022

Should we do the same for tasks?

// A workflow exists with different structure - sending much data to help debug on sdk end
return nil, errors.NewFlyteAdminErrorf(
codes.InvalidArgument,
"workflow with different structure already exists with that id: %v. workflow model: %+v.",
Copy link
Contributor

@katrogan katrogan Oct 14, 2022

Choose a reason for hiding this comment

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

if I'm understanding the original issue correctly, we want flytekit to be able to fetch the existing workflow with an identical digest and then do the comparison on the client-side in order to surface what in the workflow structure has specifically changed.

Right now the existingMatchingWorkflow type is an internal db model, with a serialized closure that's not particularly parseable by the flytekit client

I think what we should do is add a proper error type with a detailed structure, similar to these to return the existing matching workflow identifier and return this new error in this block. That way the flytekit client can then do a follow-up api call to Get the matching workflow, which will return the full workflow closure in a structured format that flytekit error handling can sensibly use to compare to the workflow definition it is trying to register

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@katrogan awesome feedback. thanks much! I took another shot at it. Let me know what you think and looks good, then I'll re-do the python end to in this PR: flyteorg/flytekit#1235

@katrogan
Copy link
Contributor

awesome! I think for completeness you might first need to make a change in flyteidl, much like we have for the current EventFailureReasons which allow us to specify the Reason structure in event write errors. Your new message can embed the workflow identifier in the reason.

Since your change isn't related to event handling I think the best thing would be to define a new message in the flyteadmin idl, perhaps in workflow.proto to capture WorkflowCreateFailureReason or something similar.

@katrogan
Copy link
Contributor

hey @jerempy thanks for making the idl changes! I think you should be able to pick them up here by pinning the idl version in go.mod with your new workflow error

@jerempy
Copy link
Contributor Author

jerempy commented Oct 25, 2022

@katrogan :high-five-emoji: 😎 and we're back. Ready for review: I added in the new protos

@jerempy
Copy link
Contributor Author

jerempy commented Oct 25, 2022

@EngHabu I created the new issue for tracking doing this with tasks: flyteorg/flyte#3027 🙏 if you could review this one again plz.

Copy link
Contributor

@EngHabu EngHabu left a comment

Choose a reason for hiding this comment

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

Thank you for making the change! I've a small comment

@@ -16,10 +16,16 @@ type FlyteAdminError interface {
Error() string
Code() codes.Code
GRPCStatus() *status.Status
WithDetails(details *admin.EventFailureReason) (FlyteAdminError, error)
WithDetails(details ProtoMessager) (FlyteAdminError, 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 believe there is a proto.Message interface that looks awfully similar. maybe take a look at that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EngHabu you're right! Found it and plugged it int. Thanks

@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #487 (a815ab7) into master (c80bd7c) will increase coverage by 0.03%.
The diff coverage is 74.19%.

@@            Coverage Diff             @@
##           master     #487      +/-   ##
==========================================
+ Coverage   61.62%   61.66%   +0.03%     
==========================================
  Files         158      158              
  Lines       11500    11524      +24     
==========================================
+ Hits         7087     7106      +19     
- Misses       3679     3682       +3     
- Partials      734      736       +2     
Flag Coverage Δ
unittests 60.60% <71.42%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
pkg/manager/impl/workflow_manager.go 59.54% <50.00%> (+0.08%) ⬆️
pkg/errors/errors.go 61.84% <77.77%> (+7.84%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jerempy
Copy link
Contributor Author

jerempy commented Oct 27, 2022

Any insight what I should do here about the missing project code coverage? 😅

EngHabu
EngHabu previously approved these changes Oct 27, 2022
Copy link
Contributor

@EngHabu EngHabu left a comment

Choose a reason for hiding this comment

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

Cool thank you.
I'll merge it for you, don't worry

"workflow with different structure already exists with id %v", request.Id)
// A workflow exists with different structure
existingCtx := getWorkflowContext(ctx, request.Id)
existingWorkflow, err := util.GetWorkflow(existingCtx, w.db, w.storageClient, *request.Id)
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of calling get again on the existing workflow, can we just have NewWorkflowExistsDifferentStructureError take in a core.Identifier, since it doesn't need the full admin protobuf def?

Copy link
Contributor

@katrogan katrogan left a comment

Choose a reason for hiding this comment

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

mind updating the errors to accept just the workflow identifier so we don't have to do a full get/transform on the existing workflow?

return more data if workflow already exists with different structure

Signed-off-by: jerempy <[email protected]>
So we send back the workflow instead of request id

Signed-off-by: jerempy <[email protected]>
new proto buffers in flyteidl

Signed-off-by: jerempy <[email protected]>
just pass the request.Id instead

Signed-off-by: jerempy <[email protected]>
@jerempy
Copy link
Contributor Author

jerempy commented Oct 27, 2022

@katrogan done. looks better this way. nice call.

@katrogan katrogan merged commit 1817f38 into flyteorg:master Oct 28, 2022
@welcome
Copy link

welcome bot commented Oct 28, 2022

Congrats on merging your first pull request! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Housekeeping] [flytekit] List differences on conflicting definition when registering
4 participants