Add escape for scalars to binding during union handling #2460
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tracking issue
Related to flyteorg/flyte#5321. This was discovered while implementing that PR.
Why are the changes needed?
The main issue is highlighted in the test added to the test type engine file. When you call
TypeEngine.to_literal
on a Union type, you should get back a Flyte literal with aUnion
message. This was happening correctly in the Type Engine but for some reason this wasn't happening for Binding Data.That is, if you had
the node for the
say_hello
invocation was being bound to a BindingData Literal Scalar that was just the raw string "world", not a Union that contained that string literal.What changes were proposed in this pull request?
This adds an escape mechanism and some comments in the binding data from python std function.
How was this patch tested?
Before: https://www.test.cluster/console/projects/flytesnacks/domains/development/executions/f6ba77e8684e94e1092a
After: https://www.test.cluster/console/projects/flytesnacks/domains/development/executions/f06eaea2298ad4884952
Both runs succeed.
Before: https://www.test.cluster/api/v1/workflows/flytesnacks/development/unions.hello_world_wf/4jItAJN7eckVByTXKxjsPg
After: https://www.test.cluster/api/v1/workflows/flytesnacks/development/unions.hello_world_wf/gmbOol0QMeiiHF_y99A97g
Note the after definition binds the node to a union literal, not a plain scalar.
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link