Hello Prefecters! What's up? I tried to create a ...
# prefect-community
r
Hello Prefecters! What's up? I tried to create a schedule flow using:
Copy code
from prefect import flow
from prefect.deployments import DeploymentSpec
from prefect.orion.schemas.schedules import IntervalSchedule
from datetime import timedelta


@flow(name="TestingFlow")
async def testing_flow(name="raimundo"):
    try:
        print(f"Hello {name}!")
    except Exception as e:
        print(e)


DeploymentSpec(
    flow=testing_flow,
    name="hw-30s",
    schedule=IntervalSchedule(interval=timedelta(seconds=20)),
    tags=["rai", "20s"],
)
when I run
prefect deployment create my_file.py
, that creates it correctly, but the tasks don't run. Anyone help me please 💙
There are no or tasks runs in
orion dashboard
n
Hi @Raimundo Pereira De Souza Neto - from your code, it doesn’t look like you have any tasks in your flow, so this would only show up as a flow run without any associated task runs
👀 1
r
Copy code
@task
async def print_hello(name):
    print(f"Hello {name}!")


@flow(name="TestingFlow")
async def testing_flow(name="raimundo"):
    print_hello(name)


DeploymentSpec(
    flow=testing_flow,
    name="hw-30s",
    schedule=IntervalSchedule(interval=timedelta(seconds=20)),
    tags=["rai", "20s"],
)
Hi @nicholas, with this code, I had the same result 😞 .
There are 16 late runs 👀
n
Ah that would be why you’re not seeing much then - your runs aren’t being picked up. For deployments you’ll want to create a work queue for your run and start an agent; you can read more about that here
upvote 1
❤️ 1
a
you could do:
Copy code
prefect work-queue create SOME_NAME -t rai
this will output UUID and you can use that to start an agent that will pick up those late runs:
Copy code
prefect agent start UUID
❤️ 1
upvote 1
r
thanks @nicholas and @Anna Geller
👍 2