When I use the code from <https://docs.prefect.io/...
# prefect-getting-started
p
When I use the code from https://docs.prefect.io/latest/tutorial/deployments/
Copy code
import time
from prefect import flow, serve


@flow
def slow_flow(sleep: int = 60):
    "Sleepy flow - sleeps the provided amount of time (in seconds)."
    time.sleep(sleep)


@flow
def fast_flow():
    "Fastest flow this side of the Mississippi."
    return


if __name__ == "__main__":
    slow_deploy = slow_flow.to_deployment(name="sleeper", interval=45)
    fast_deploy = fast_flow.to_deployment(name="fast")
    serve(slow_deploy, fast_deploy)
I get errors about
Result of async function call is not used
and
Copy code
Argument of type "Coroutine[Any, Any, RunnerDeployment]" cannot be assigned to parameter "args" of type "RunnerDeployment" in function "serve"
  "Coroutine[Any, Any, RunnerDeployment]" is incompatible with "RunnerDeployment"
Is this the recommended way to fix it?
Copy code
import time
from prefect import flow, serve
import asyncio

@flow
def slow_flow(sleep: int = 60):
    "Sleepy flow - sleeps the provided amount of time (in seconds)."
    time.sleep(sleep)


@flow
def fast_flow():
    "Fastest flow this side of the Mississippi."
    return

async def deploy_flows():
    slow_deploy = await slow_flow.to_deployment(name="sleeper", interval=45)
    fast_deploy = await fast_flow.to_deployment(name="fast")
    await serve(slow_deploy, fast_deploy)

if __name__ == "__main__":
    asyncio.run(deploy_flows())
āœ… 1
n
hi @Patrick Wspanialy! can you share: • the output of
prefect version
• the entire stack trace? thank you!
p
2.18.1, I see now it's not a run time error but a typing issue. I understand that typing is too much to get into in the tutorial. The red squiggles made me think something was wrong.
šŸ™ 1
n
ok! we're in the process of adopting a more strict static typer so this is still helpful - thank you!