Nash Taylor
12/17/2024, 3:50 AM@task
decorator.
Without any arguments, again it works fine. With arguments, suddenly the return type of the function is unknown, which causes problems when I try to .submit()
the task and collect results, as it ends up somehow as a Task[..., NoReturn]
. Again, full details in the threadNash Taylor
12/17/2024, 3:52 AM@task
def my_task(*, a: int, b: int) -> int:
return a + b
@task
def my_downstream_task() -> list[int]:
results: list[PrefectFuture[int]] = []
for a, b in zip(range(10), range(10)):
result = my_task.submit(a=a, b=b)
results.append(result)
return [result.result() for result in results]
But if I change to:
@task(retries=3, retry_delay_seconds=5)
Then suddenly on `results.append(result)`:
Argument of type "PrefectFuture[NoReturn]" cannot be assigned to parameter "object" of type "PrefectFuture[int]" in function "append"
"PrefectFuture[NoReturn]" is incompatible with "PrefectFuture[int]"
Type parameter "R@PrefectFuture" is invariant, but "NoReturn" is not the same as "int"PylancereportArgumentType