Hey all. I've been struggling recently with a type...
# ask-community
n
Hey all. I've been struggling recently with a type error from Pyright with my flows. I've just upgraded to Prefect 3.1.7. I'll thread the error I'm getting so they don't clutter. When I decorate a flow simply with
@flow
, everything is fine. When I try to add arguments, such as
@flow(task_runner=ThreadPoolTaskRunner(max_workers=3))
, I get the error in the thread. Thanks in advance for any help!
Copy code
Argument of type "ThreadPoolTaskRunner" cannot be assigned to parameter "task_runner" of type "TaskRunner[PrefectFuture[R@flow]] | None" in function "flow"
  Type "ThreadPoolTaskRunner" is incompatible with type "TaskRunner[PrefectFuture[R@flow]] | None"
    "ThreadPoolTaskRunner" is incompatible with "TaskRunner[PrefectFuture[R@flow]]"
      Type parameter "F@TaskRunner" is invariant, but "PrefectConcurrentFuture[Unknown]" is not the same as "PrefectFuture[R@flow]"
    "ThreadPoolTaskRunner" is incompatible with "None"PylancereportArgumentType
d
j
I'm running into this problem as well. Looking at the source code, I see task_runner is of type None, which is very odd.