-
Notifications
You must be signed in to change notification settings - Fork 302
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
Prevent register_launch_plan from re-registering already registered workflow #3049
base: master
Are you sure you want to change the base?
Conversation
…w if it already exists Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Code Review Agent Run Status
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3049 +/- ##
===========================================
+ Coverage 47.23% 73.43% +26.19%
===========================================
Files 202 202
Lines 21355 21365 +10
Branches 2744 2746 +2
===========================================
+ Hits 10088 15689 +5601
+ Misses 10776 4898 -5878
- Partials 491 778 +287 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Yee Hing Tong <wild-endeavor@users.noreply.github.com>
Code Review Agent Run #345323Actionable Suggestions - 1
Additional Suggestions - 1
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
if remote_wf is None: | ||
ident = run_sync( | ||
self._serialize_and_register, | ||
entity, | ||
serialization_settings, | ||
version, | ||
options, | ||
False, | ||
) | ||
else: | ||
launch_plan_model = get_serializable( | ||
OrderedDict(), settings=serialization_settings, entity=entity, options=options | ||
) | ||
ident = self.raw_register( | ||
launch_plan_model, serialization_settings, version, create_default_launchplan=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.
Consider extracting the workflow existence check and registration logic into a separate helper method to improve code organization and reusability. The current implementation has duplicate logic for handling workflow registration.
Code suggestion
Check the AI-generated fix before applying
if remote_wf is None: | |
ident = run_sync( | |
self._serialize_and_register, | |
entity, | |
serialization_settings, | |
version, | |
options, | |
False, | |
) | |
else: | |
launch_plan_model = get_serializable( | |
OrderedDict(), settings=serialization_settings, entity=entity, options=options | |
) | |
ident = self.raw_register( | |
launch_plan_model, serialization_settings, version, create_default_launchplan=False | |
) | |
ident = self._register_workflow_if_needed(remote_wf, entity, serialization_settings, version, options) |
Code Review Run #345323
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Tracking issue
Linking this to flyteorg/flyte#6062 which is related.
Why are the changes needed?
Please see comment in the linked issue, copied here:
Assume in the past
my_wf
has already been registered with versionksD2LBYDu5PrNtNnnpd95Q
Now if you try to do:
The issue is that
register_launch_plan
will currently try to register the underlying workflow again. This would be fine, except that the serialization settings that are used may be completely different. Even if it's exactly the same, this is a waste of time because the best case scenario is that Admin returns already exists for the workflow and every underlying task (and subwf, etc.).We should check first to see if the workflow already exists with that version, and only register the launch plan if the workflow already exists.
Skipping re-registration of the workflow does mean that users who were relying on this re-registration (and were somehow reconstructing serialization settings to be identical) to detect changes in workflow/task structure will no longer see errors, but that seems too far-fetched.
What changes were proposed in this pull request?
create_default_launchplan
) in_serialize_and_register
which for some reason wasn't used. Just a nit, default was always justTrue
.How was this patch tested?
Tested with local sandbox.
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This PR streamlines the launch plan registration process by implementing checks to prevent redundant workflow registrations. The changes optimize the registration flow by adding existence verification and proper handling of the create_default_launchplan parameter. The implementation focuses on efficiency and maintainability through improved registration logic.Unit tests added: True
Estimated effort to review (1-5, lower is better): 1