Thread
#prefect-community
    Rajan Subramanian

    Rajan Subramanian

    6 months ago
    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
    Kevin Kho

    Kevin Kho

    6 months ago
    The schedule is decoupled from the Flow object now. You are looking for Deployments
    Rajan Subramanian

    Rajan Subramanian

    6 months ago
    would this be in schedule_runs() in orion.models.deployments?
    Kevin Kho

    Kevin Kho

    6 months ago
    The DeploymentSpec takes in a schedule:
    >>> from prefect.orion.schemas.schedules import IntervalSchedule
    >>> from datetime import timedelta
    >>> DeploymentSpec(
    >>>     ...
    >>>     schedule=IntervalSchedule(interval=timedelta(hours=1))
    >>> )