https://prefect.io logo
Title
r

Rajan Subramanian

03/02/2022, 6:23 PM
Hello, how does one create a schedule in orion similar to prefect core? I had:
from prefect.orion.schemas.schedules import IntervalSchedule
schedule = IntervalSchedule(interval=timedelta(minutes=5))
@flow(
    name="redis_to_postgres_pipeline", task_runner=DaskTaskRunner(), schedule=schedule
)
def run_flow(shell_task: str):
    cmd = build_command(shell_task)
    run_in_shell(command=cmd)
Getting an error, flow doesn't accept schedule as argument anymore
k

Kevin Kho

03/02/2022, 6:25 PM
The schedule is decoupled from the Flow object now. You are looking for Deployments
r

Rajan Subramanian

03/02/2022, 6:27 PM
would this be in schedule_runs() in orion.models.deployments?
k

Kevin Kho

03/02/2022, 6:32 PM
The DeploymentSpec takes in a schedule:
>>> from prefect.orion.schemas.schedules import IntervalSchedule
>>> from datetime import timedelta
>>> DeploymentSpec(
>>>     ...
>>>     schedule=IntervalSchedule(interval=timedelta(hours=1))
>>> )
:upvote: 1