i just didnt wanna give the whole object to the task, i just want 1 field from it ๐
g
glamorous-carpet-83516
04/03/2023, 11:23 PM
unfortunately, you canโt get the name from promise.
you could use dynamic workflow to workaround it. like
@dynamic
def d1(res: MyDataClass) -> None:
another_task(name=res.name)
m
magnificent-teacher-86590
04/03/2023, 11:42 PM
i see, do you think it would change in the future so that Promise knows the attrib of the underlying outputs and inputs
h
hallowed-mouse-14616
04/04/2023, 1:13 PM
@magnificent-teacher-86590 we have had some small discussion surrounding this. The use-case can be either using individual fields of a dataclass or indexing into a list. The issue with dataclass support is that currently flytekit handles serialization / deserialization of data and the backend (ie. flytepropeller) is completely unaware of format. To add support for using individual fields we would need to add additional context to the data type. It is certainly something we can do in the future, but currently not very high priority.
๐ 1
m
magnificent-teacher-86590
04/04/2023, 4:17 PM
gotcha, thank you for the detailed explanation ๐