Skip to content
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

Add literal type to union literal #1144

Merged
merged 4 commits into from
Sep 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add literal type to union literal
Signed-off-by: Kevin Su <pingsutw@apache.org>
pingsutw committed Aug 29, 2022

Verified

This commit was signed with the committer’s verified signature.
pingsutw Kevin Su
commit dfba3d822ccd409e300e9c98aaee18a5bd689d0b
4 changes: 2 additions & 2 deletions flytekit/clis/sdk_in_container/run.py
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
from flytekit.core.workflow import PythonFunctionWorkflow, WorkflowBase
from flytekit.models import literals
from flytekit.models.interface import Variable
from flytekit.models.literals import Blob, BlobMetadata, Primitive
from flytekit.models.literals import Blob, BlobMetadata, Primitive, Union
from flytekit.models.types import LiteralType, SimpleType
from flytekit.remote.executions import FlyteWorkflowExecution
from flytekit.tools import module_loader, script_mode
@@ -265,7 +265,7 @@ def convert_to_union(
python_val = converter._click_type.convert(value, param, ctx)
literal = converter.convert_to_literal(ctx, param, python_val)
self._python_type = python_type
return literal
return Literal(scalar=Scalar(union=Union(literal, variant)))
except (Exception or AttributeError) as e:
logging.debug(f"Failed to convert python type {python_type} to literal type {variant}", e)
raise ValueError(f"Failed to convert python type {self._python_type} to literal type {lt}")