-
Notifications
You must be signed in to change notification settings - Fork 309
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: support positional args for ref entity #3104
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: machichima <[email protected]>
Signed-off-by: machichima <[email protected]>
Code Review Agent Run #942e72Actionable Suggestions - 1
Review Details
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3104 +/- ##
==========================================
- Coverage 79.52% 76.13% -3.39%
==========================================
Files 272 202 -70
Lines 24614 21475 -3139
Branches 2768 2770 +2
==========================================
- Hits 19574 16351 -3223
- Misses 4238 4308 +70
- Partials 802 816 +14 ☔ View full report in Codecov by Sentry. |
Changelist by BitoThis pull request implements the following key changes.
|
@@ -187,7 +186,7 @@ def construct_node_metadata(self) -> _workflow_model.NodeMetadata: | |||
return _workflow_model.NodeMetadata(name=extract_obj_name(self.name)) | |||
|
|||
def compile(self, ctx: FlyteContext, *args, **kwargs): | |||
return create_and_link_node(ctx, entity=self, **kwargs) | |||
return create_and_link_node(ctx, self, *args, **kwargs) |
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 if the change from entity=self
to positional argument self
could impact any callers expecting keyword arguments. The function signature in create_and_link_node
expects entity
as a keyword parameter.
Code suggestion
Check the AI-generated fix before applying
return create_and_link_node(ctx, self, *args, **kwargs) | |
return create_and_link_node(ctx, entity=self, *args, **kwargs) |
Code Review Run #942e72
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
@@ -200,10 +199,6 @@ def __call__(self, *args, **kwargs): | |||
# nothing. Subsequent tasks will have to know how to unwrap these. If by chance a non-Flyte task uses a | |||
# task output as an input, things probably will fail pretty obviously. | |||
# Since this is a reference entity, it still needs to be mocked otherwise an exception will be raised. | |||
if len(args) > 0: |
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.
Could we convert args to kwargs here instead? Then, we don't need to change the signature of create_and_link_node
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.
It will be great to have a small test for it
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.
Sure! I will modify it and add some tests
Tracking issue
Similar to issue: flyteorg/flyte#5320, but for reference entities
Why are the changes needed?
Support positional args for reference task, workflow, and launch plan.
Originally, following code will fail with error like:
FlyteAssertion: USER:AssertionError: error=Cannot call reference entity with args - detected 2 positional args (Promise(node:.x.[]), Promise(node:.y.[]))
What changes were proposed in this pull request?
Write values in positional arguments (args) into kwargs
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This PR enhances reference entities (tasks, workflows, and launch plans) by adding support for positional arguments. The implementation includes argument validation, conversion of positional to keyword arguments, and removes restrictions on using positional arguments. The changes maintain backward compatibility while providing more flexible argument passing options.Unit tests added: False
Estimated effort to review (1-5, lower is better): 1