Hi there, I noticed that the schedule option has d...
# prefect-ui
i
Hi there, I noticed that the schedule option has disappeared from the UI Deployment page. After Friday's updates, flows do not run on schedule. Is it a bug, or you move this option to a different place? The schedule will be deprecated in Sep 2024. Also, how can we be aware of the changes you make in advance? Thanks
j
Hi @Iryna - schedules should very much still be on the deployment page. On smaller screens you may need to look in the details tab. If you don’t see it, can you let me know if you’re in open source or cloud and whether you’re missing the schedule information or the “+ Schedule” button.
i
@Jenny I use the build_from_flow deployment method with a cron schedule. and when it is deployed, the schedule disappeared. Also, it is absent from the UI when I click edit deployment. this is my code deploy flows
Copy code
deployment = Deployment.build_from_flow(
    name=depl_name,
    flow=flow,
    tags=tags,
    parameters=params,
    infra_overrides={"env": {"PREFECT_LOGGING_LEVEL": "DEBUG"}},
    work_queue_name=work_queue_name,
    schedule=(CronSchedule(cron="0 0 * * *", timezone="America/Chicago")),
    storage=storage,
    entrypoint=flow_entrypoint,
)
deployment.apply()
j
Hmmm… that sounds odd to me. Let me check with the team on this one.
👍 1
c
Hi @Iryna, thanks for flagging this issue! While we work on a fix, try using the
schedules
(plural) parameter, it’s similar to
schedule
but takes a list of schedules. Here’s a full example:
Copy code
from prefect import flow
from prefect.deployments import Deployment

from prefect.client.schemas.schedules import CronSchedule


@flow(log_prints=True)
def local_flow():
    print("I'm a flow written to test deploy from source")


if __name__ == "__main__":
    deployment = Deployment.build_from_flow(
        name="test-sched",
        flow=local_flow,
        infra_overrides={"env": {"PREFECT_LOGGING_LEVEL": "DEBUG"}},
        work_queue_name="managed",
        schedules=[CronSchedule(cron="0 0 * * *", timezone="America/Chicago")],
    )
    deployment.apply()
i
@Chris Pickett thanks. schedules does't work too with cron
schedules=[CronSchedule(cron="0 0 * * *", timezone="America/Chicago")]
I got this error:
Copy code
Error deploying flows: 1 validation error for Deployment
__root__
  Invalid schedule provided. Must be a schedule object, a dict, or a MinimalDeploymentSchedule. (type=value_error)
I fixed the issue with minimal deployment schedule
Copy code
schedules=[MinimalDeploymentSchedule(schedule=(CronSchedule(cron=cron, timezone=timezone))),]
c
It sounds like your first issue might be because you imported from ‘prefect.server.schemas’, you want ‘prefect.client.schemas’. I ran into that issue earlier today and was mighty confused for a bit.
We merged a fix for this issue today, I also included a fix for this wrong schemas situation.
i
I see. Thanks for that. It would be nice to have it documented somewhere. So confusing.
j
This should be fixed in todays release.
🙌 1
224 Views