<#5856 [BUG] Enable Resolving Attribute Path for L...
# flytekit
c
#5856 [BUG] Enable Resolving Attribute Path for List or Dict Workflow Inputs Issue created by Mecoli1219 Describe the bug When we define a workflow where one of the tasks will take a list as input. When we use a Promise with an attribute path from another task or sub-workflow as one element of the input, It will throw an error. For instance:
Copy code
@task(container_image=image)
def task_1(in1: int) -> typing.List[int]:
    return list(range(max(2, in1)))

@task(container_image=image)
def task_2(in1: int, in2: typing.List[int]) -> int:
    return in1 + sum(in2)

@workflow
def my_wf(in1: int, in2: int) -> int:
    a = task_1(in1=in1)
    a1 = a[0]
    a2 = a[1]
    return task_2(in1=5, in2=[a1, a2, in2])
Here,
in2
of the input
task_2
will be a list of Promise, and promise::_translate_inputs_to_literals will transform it to Literal (
LiteralCollection
in this case). However, it didn't try to resolve the attribute path of the Promises inside the list. Therefore, this error is received: image This is just an example of a List of Promises. There should be a similar error with Dictionary and Tuple (Tuple is currently under development). Expected behavior It should be supported. Additional context to reproduce No response Screenshots No response Are you sure this issue hasn't been raised already? • Yes Have you read the Code of Conduct? • Yes flyteorg/flyte