Okay and one more, regarding arguments to the `@ta...
# ask-community
n
Okay and one more, regarding arguments to the
@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 thread
Works fine:
Copy code
@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:
Copy code
@task(retries=3, retry_delay_seconds=5)
Then suddenly on `results.append(result)`:
Copy code
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