Open rosscleung opened 1 year ago
Work around with
from prefect.utilities.annotations import quote
testTask(quote(foo))
See also https://github.com/PrefectHQ/prefect/pull/8763 / https://github.com/PrefectHQ/prefect/issues/8542
We should add documentation about this.
First check
Bug summary
I have a dataclass, a task, and a flow.
In the dataclass, it checks one of its own parameters and initializes that parameter to a value if it's a
None
inside the post_init(). If the post_init() gets called a second time, then it will think that the same parameter is no longerNone
and the parameter gets set a different value.A lead software engineer from Prefect addressed and confirmed this behavior. It is due to when
futures
objects get passed down the DAG, the parameters get "resolved", and that's why __post_init__() was called again. This is a pretty "silent" behavior that can catch people off guard, that's why I'm still posting this issue with reproducible code below.TL;DR: Be careful of the "state" of your objects as they get passed around the DAG!
Reproduction
Error
Versions
Additional context
Thank you Zanie for the quick response on Prefect Slack!