-
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
Support with_overrides setting metadata for map_task subnode instead of parent node #2982
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Paul Dittamo <[email protected]>
Signed-off-by: Paul Dittamo <[email protected]>
Signed-off-by: Paul Dittamo <[email protected]>
Code Review Agent Run Status
|
Signed-off-by: Paul Dittamo <[email protected]>
noticed a separate issue: flyteorg/flyte#6153 - will get a quick fix for this after this is merged. Also need to follow up with fixing this for ArrayNode (mapping over ref tasks that I need to upstream the BE changes for) |
Code Review Agent Run #a0a338Actionable Suggestions - 2
Additional Suggestions - 1
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
self.sub_node_metadata: NodeMetadata = super().construct_node_metadata() | ||
self.sub_node_metadata._name = self.name |
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 using the constructor parameters to set the name
property when creating NodeMetadata
instead of modifying the protected _name
attribute directly. This would follow better encapsulation practices.
Code suggestion
Check the AI-generated fix before applying
self.sub_node_metadata: NodeMetadata = super().construct_node_metadata() | |
self.sub_node_metadata._name = self.name | |
self.sub_node_metadata: NodeMetadata = NodeMetadata(name=self.name, timeout=self.metadata.timeout, retries=self.metadata.retry_strategy, interruptible=self.metadata.interruptible) |
Code Review Run #a0a338
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
@@ -624,7 +624,7 @@ def get_serializable_array_node_map_task( | |||
) | |||
node = workflow_model.Node( | |||
id=entity.name, | |||
metadata=entity.construct_sub_node_metadata(), | |||
metadata=entity.get_sub_node_metadata(), |
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 renaming the method from construct_sub_node_metadata()
to get_sub_node_metadata()
maintains backward compatibility. This change could potentially break existing code that relies on the old method name.
Code suggestion
Check the AI-generated fix before applying
metadata=entity.get_sub_node_metadata(), | |
metadata=entity.construct_sub_node_metadata() if hasattr(entity, 'construct_sub_node_metadata') else entity.get_sub_node_metadata(), |
Code Review Run #a0a338
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
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.
Minor nit, otherwise LGTM
def get_sub_node_metadata(self) -> NodeMetadata: | ||
return self.sub_node_metadata |
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.
The pattern in flytekit is to use a property + a private attribute:
@property
def sub_node_metadata(self) -> NodeMetadata:
return self._sub_node_metadata
Tracking issue
fixes: https://linear.app/unionai/issue/COR-2498/with-overrides-sets-metadata-for-parent-instead-of-subnode-for-map
Why are the changes needed?
with_overrides doesn't work for map_tasks
What changes were proposed in this pull request?
create a new field in array node map task to explicitl
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This PR addresses a critical bug in map_tasks where metadata was incorrectly being set on parent nodes instead of subnodes. The implementation introduces a dedicated sub_node_metadata field and refactors metadata override logic to ensure proper application of settings like timeout, cache, and container image to mapped subtasks.Unit tests added: False
Estimated effort to review (1-5, lower is better): 2