cuddly-jelly-27016
02/03/2025, 6:43 PM[User] malformed dynamic workflow, caused by: Collected Errors: 10
Error 0: Code: MismatchingBindings, Node Id: dn0, Description: Input [l] on node [dn0] expects bindings of type [simple:STRUCT]. Received []
When transform pydantic model into a dict the error is:
TypeError: Failed to convert inputs of task 'flyte.workflows.test_wf.level2':
'NoneType' object is not subscriptable
Expected behavior
Pydantic models and dictionaries bind properly to the nested dynamic task
Additional context to reproduce
Pydantic:
from typing import List
from flytekit import ImageSpec, dynamic, workflow
from pydantic.v1 import BaseModel
class SModel(BaseModel):
name: str
@dynamic(container_image=pydantic_image)
def level2(l: SModel) -> List[int]:
return [1, 2, 3]
@dynamic(container_image=pydantic_image)
def level1(l: List[int]) -> str:
v = []
for i in l:
v.append(level2(l=SModel(name="a")))
return "test"
@workflow
def multi_wf(l: List[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -> str:
return level1(l=l)
Dict:
from typing import List
from flytekit import ImageSpec, dynamic, workflow
from pydantic.v1 import BaseModel
class SModel(BaseModel):
name: str
@dynamic(container_image=pydantic_image)
def level2(l: dict) -> List[int]:
return [1, 2, 3]
@dynamic(container_image=pydantic_image)
def level1(l: List[int]) -> str:
v = []
for i in l:
v.append(level2(l=SModel(name="a").dict()))
return "test"
@workflow
def multi_wf(l: List[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) -> str:
return level1(l=l)
Screenshots
No response
Are you sure this issue hasn't been raised already?
• Yes
Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
02/03/2025, 6:43 PM