<#479 Add structure attribute back to the CRD> Pul...
# flyte-github
a
#479 Add structure attribute back to the CRD Pull request opened by pingsutw Signed-off-by: Kevin Su pingsutw@apache.org TL;DR #442 remove
structure
from CRD at runtime, but we do need it for type validation. check validateInputs -> AreTypesCastable -> CastsFrom -> GetTagForType Error:
Copy code
File "/Users/kevin/git/flytekit/flytekit/clients/raw.py", line 41, in handler
    return fn(*args, **kwargs)
  File "/Users/kevin/git/flytekit/flytekit/clients/raw.py", line 615, in create_execution
    return self._stub.CreateExecution(create_execution_request, metadata=self._metadata)
  File "/Users/kevin/opt/anaconda3/envs/flytekit-3.9/lib/python3.9/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/kevin/opt/anaconda3/envs/flytekit-3.9/lib/python3.9/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.INTERNAL
	details = "Collected Errors: 2
	Error 0: Code: MismatchingTypes, Node Id: start-node, Description: Variable [b] (type [union_type:<variants:<simple:INTEGER > variants:<simple:STRING > > ]) doesn't match expected type [union_type:<variants:<simple:INTEGER structure:<tag:"int" > > > ].
	Error 1: Code: ParameterNotBound, Node Id: start-node, Description: Parameter not bound [b].
"
	debug_error_string = "{"created":"@1662108544.130630000","description":"Error received from peer ipv4:34.201.131.50:30081","file":"src/core/lib/surface/call.cc","file_line":1075,"grpc_message":"Collected Errors: 2\n\tError 0: Code: MismatchingTypes, Node Id: start-node, Description: Variable [b] (type [union_type:<variants:<simple:INTEGER > variants:<simple:STRING > > ]) doesn't match expected type [union_type:<variants:<simple:INTEGER structure:<tag:"int" > > > ].\n\tError 1: Code: ParameterNotBound, Node Id: start-node, Description: Parameter not bound [b].\n","grpc_status":13}"
Type ☑︎ Bug Fix ☐ Feature ☐ Plugin Are all requirements met? ☑︎ Code completed ☑︎ Smoke tested ☐ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description The commands tp repro,
Copy code
$ pip install git+<https://github.com/flyteorg/flytekit@union-bug>
$ pyflyte --config ~/.flyte/config-remote.yaml run --remote example_union1.py wf --b 2`
Copy code
from flytekit import task, workflow                                                                           
from typing import Union, List
from enum import Enum


@task
def t1(a:  Union[int, str]) -> Union[int, str]:
    return "hello"

@task
def t2(a: Union[int, str]) -> Union[int, str]:
    return "hello"

@workflow
def wf(b:  Union[int, str]):
    t1(a=t2(a=b))
Tracking Issue flyteorg/flyte#2817 flyteorg/flytekit#1144 Follow-up issue NA flyteorg/flytepropeller GitHub Actions: Goreleaser GitHub Actions: Build & Push Flytepropeller Image GitHub Actions: Bump Version 11 other checks have passed 11/14 successful checks