-
Notifications
You must be signed in to change notification settings - Fork 690
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
Clear inputs from dynamic closure to avoid bloating the event message #6234
Clear inputs from dynamic closure to avoid bloating the event message #6234
Conversation
* Clear inputs for the dynamic workflow to avoid bloating the event message Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com> * Clear inputs for the dynamic workflow to avoid bloating the event message Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com> --------- Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com>
Code Review Agent Run #24d5dcActionable Suggestions - 1
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
// This function is used to clear the inputs of the nodes in the dynamic workflow. This is done to avoid bloating the node event. | ||
func clearNodeInputs(ctx context.Context, nodes []*core.Node) { | ||
for _, node := range nodes { | ||
node.Inputs = nil | ||
switch node.Target.(type) { | ||
case *core.Node_ArrayNode: | ||
node.Target.(*core.Node_ArrayNode).ArrayNode.Node.Inputs = nil | ||
default: | ||
logger.Debugf(ctx, "node type %T not supported for clearing inputs", node.Target) | ||
} | ||
} | ||
} |
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 adding error handling for the case when node.Target
is nil
. Currently, the code assumes node.Target
is always non-nil which could lead to a panic.
Code suggestion
Check the AI-generated fix before applying
@@ -227,11 +227,14 @@ func clearNodeInputs(ctx context.Context, nodes []*core.Node) {
for _, node := range nodes {
node.Inputs = nil
if node.Target == nil {
logger.Debugf(ctx, "node target is nil for node %v", node.Id)
continue
}
switch node.Target.(type) {
case *core.Node_ArrayNode:
node.Target.(*core.Node_ArrayNode).ArrayNode.Node.Inputs = nil
default:
logger.Debugf(ctx, "node type %T not supported for clearing inputs", node.Target)
}
}
Code Review Run #24d5dc
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6234 +/- ##
=======================================
Coverage 36.87% 36.87%
=======================================
Files 1318 1318
Lines 134647 134656 +9
=======================================
+ Hits 49647 49657 +10
+ Misses 80679 80678 -1
Partials 4321 4321
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: pmahindrakar-oss <prafulla.mahindrakar@gmail.com>
Code Review Agent Run #2eb337Actionable Suggestions - 0Review Details
|
Tracking issue
Upstream changes from union
Why are the changes needed?
The dynamic closure contains inputs for all dynamic nodes. However, these inputs are included when constructing node events sent to the admin, despite not being used by any clients. A comparison of Flyte Console and FlyteKit confirms this redundancy as they use GetNodeExecutionData to fetch this data along with for outputs.
Sending such large inputs in the dynamic closure occasionally exceeds gRPC limits, causing execution failures. Even when the payload remains within the limit, its large size (in MBs) results in sluggish UI performance, as clients must process and render unnecessary data.
What changes were proposed in this pull request?
We remove node inputs before sending the event to the admin, enhancing UI performance when fetching the dynamic closure for the node view. This also prevents cases where exceeding gRPC limits would cause dynamic node execution to fail.
How was this patch tested?
Verified by running a large dynamic workflow which contained large inputs and verified the page loads sped up which called the dynamic workflow api.
Notice before and after number of bytes loaded
Before the change (3.9 MB)
After the change
Labels
Please add one or more of the following labels to categorize your PR:
This is important to improve the readability of release notes.
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
Implementation of a new clearNodeInputs function to optimize dynamic node event messages by removing input data from regular and array nodes. This optimization reduces payload size, prevents gRPC limit issues, and enhances UI performance. Changes include refactoring to use getter methods instead of direct field access for node inputs and targets. The implementation ensures proper handling of dynamic workflow closures before sending events to admin.Unit tests added: True
Estimated effort to review (1-5, lower is better): 1