-
Notifications
You must be signed in to change notification settings - Fork 313
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 bound inputs for array node tasks #3185
Conversation
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]>
Signed-off-by: Paul Dittamo <[email protected]>
This reverts commit 89c5895. Signed-off-by: Paul Dittamo <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3185 +/- ##
===========================================
- Coverage 89.32% 73.15% -16.17%
===========================================
Files 134 213 +79
Lines 6136 22301 +16165
Branches 0 2914 +2914
===========================================
+ Hits 5481 16315 +10834
- Misses 655 5169 +4514
- Partials 0 817 +817 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review Agent Run #f8b189Actionable Suggestions - 1
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
# Note, bound_inputs are passed in during run time when executing the task | ||
# so both values shouldn't be set at the same time | ||
if bound_inputs and bound_inputs_values: | ||
if bound_inputs != set(bound_inputs_values): |
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 condition bound_inputs != set(bound_inputs_values)
might not work as expected when comparing a set with dictionary keys. Consider using bound_inputs != set(bound_inputs_values.keys())
to ensure proper comparison between the set and dictionary keys.
Code suggestion
Check the AI-generated fix before applying
if bound_inputs != set(bound_inputs_values): | |
if bound_inputs != set(bound_inputs_values.keys()): |
Code Review Run #f8b189
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
# so both values shouldn't be set at the same time | ||
if bound_inputs and bound_inputs_values: | ||
if bound_inputs != set(bound_inputs_values): | ||
raise ValueError("bound_inputs and bound_inputs_values should have the same keys if both set") |
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.
Can we include a test that triggers this error?
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.
added
Signed-off-by: Paul Dittamo <[email protected]>
Code Review Agent Run #d4467dActionable Suggestions - 0Review Details
|
with pytest.raises(ValueError, match="bound_inputs and bound_inputs_values should have the same keys if both set"): | ||
ArrayNodeMapTask(task1, bound_inputs_values={"c": param_c}, bound_inputs={"b"})(a=param_a, b=param_b) | ||
|
||
try: |
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.
Can this also use pytest.raises
?
Also, how does the error get triggered from union.map
?
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.
@thomasjpfan Should we use pytest.raises here since it's not raising an error?
We shouldn't really ever hit this error. Have this PR that exposes bound_inputs param for union.map
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.
Ah it's the other way around. In that case, I'm okay with just writing and let pytest see the original error.
# no error raised
ArrayNodeMapTask(task1, bound_inputs_values={"c": param_c}, bound_inputs={"c"})(a=param_a, b=param_b)
with pytest.raises(ValueError, match="bound_inputs and bound_inputs_values should have the same keys if both set"): | ||
ArrayNodeMapTask(task1, bound_inputs_values={"c": param_c}, bound_inputs={"b"})(a=param_a, b=param_b) | ||
|
||
try: |
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.
Ah it's the other way around. In that case, I'm okay with just writing and let pytest see the original error.
# no error raised
ArrayNodeMapTask(task1, bound_inputs_values={"c": param_c}, bound_inputs={"c"})(a=param_a, b=param_b)
Signed-off-by: Paul Dittamo <[email protected]>
Code Review Agent Run #22f506Actionable Suggestions - 0Review Details
|
Tracking issue
fixes: https://linear.app/unionai/issue/BB-2941/utilize-bound-inputs-for-partials-for-map-tasks
Why are the changes needed?
What changes were proposed in this pull request?
add support for setting bound_inputs for ArrayNodeMapTask
How was this patch tested?
https://dogfood.cloud-staging.union.ai/console/projects/flytesnacks/domains/development/executions/a29rf95w9fx4hvqjpnt8/nodeId/n0/nodes
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link
Summary by Bito
This PR adds support for bound inputs in ArrayNodeMapTask with input consistency validation and improves input validation. The implementation includes updates to the flytekit core and translator module, implementing checks for key mismatches between 'bound_inputs' and 'bound_inputs_values'. Unit tests were updated to remove try-except blocks for cleaner error detection, enhancing robustness and flexibility in map task handling.Unit tests added: True
Estimated effort to review (1-5, lower is better): 2