A question on how to use async tasks: Context ```...
# prefect-community
t
A question on how to use async tasks: Context
Copy code
class Result:
  pass

@task
async def my_task_1(arg: str) -> Result:
  ...

@task
async def my_task_2(arg: Result) -> None:
  ...
Question Doc says I can do
await my_task_1('arg')
in a flow, although mypy says
my_task_1('arg')
is not awaitable Is following a best practice?
Copy code
task_result = await my_task.submit('arg')
result = await task_result.result()

await my_task_2.submit(result)
b
Hey Tony, assuming this is for 2.0, this article may help you out. Check out the very last post, it shows how to accomplish this in a cleaner syntax
t
@Bianca Hoch Thanks, mypy is certainly not accepting that approach though
b
Well that's unfortunate. Would you mind sharing the error message?