Hello, how does one create a schedule in orion sim...
# ask-community
r
Hello, how does one create a schedule in orion similar to prefect core? I had:
Copy code
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
The schedule is decoupled from the Flow object now. You are looking for Deployments
r
would this be in schedule_runs() in orion.models.deployments?
k
The DeploymentSpec takes in a schedule:
Copy code
>>> from prefect.orion.schemas.schedules import IntervalSchedule
>>> from datetime import timedelta
>>> DeploymentSpec(
>>>     ...
>>>     schedule=IntervalSchedule(interval=timedelta(hours=1))
>>> )
upvote 1