<@ULVA73B9P> I am trying to debug an issue where a...
# marvin-ai
u
@Marvin I am trying to debug an issue where a prefect v3 deployment is creating 2 runs for each schedule
m
thought for 607.2 seconds
Got it — let’s track this down. In Prefect 3.x the most common reason for “two runs per schedule” is that more than one thing is triggering the deployment at the same time (e.g., multiple active schedules on the same deployment or an Automation that also runs the deployment). Here’s a quick, reliable way to diagnose: Quick checks 1) List schedules on the deployment (look for more than one active schedule)
Copy code
prefect deployment schedule ls "<flow_name>/<deployment_name>"
- If you see multiple schedules and only want one, either delete or pause the extras:
Copy code
prefect deployment schedule delete "<flow_name>/<deployment_name>" <schedule_id> -y
# or pause
prefect deployment schedule pause "<flow_name>/<deployment_name>" <schedule_id>
- If you want to remove all schedules and start fresh:
Copy code
prefect deployment schedule clear "<flow_name>/<deployment_name>"
2) Check for Automations that also run this deployment
Copy code
prefect automation ls
prefect automation inspect <automation_id>
- Look for actions of type “Run deployment” pointing to your deployment. If present, that Automation will create an additional run in addition to the deployment’s schedule. Disable/pause if unintended. 3) Compare the “Created by” for each duplicate run - In the UI, open both runs and look at Details → Created by. Typical sources: - “Deployment schedule” (scheduled) - “Automation” (automation) - “Manual/API” (manual triggers) If one run is from the schedule and the other is from an automation, that explains the duplicates. 4) Confirm there isn’t a second deployment for the same flow creating runs at the same time
Copy code
prefect deployment ls
- Check if there’s another deployment with its own schedule running at the same cadence. 5) Timezone/DST edge case - If you’re near a daylight savings fallback (e.g., 01:00 local time occurs twice), a cron like “0 1 …” can legitimately create two runs. Confirm your schedule timezone and the date this started. What typically causes this - Redeploying added a new schedule without removing the old one. Prefect won’t auto-delete prior schedules on update, so both continue to trigger. - An Automation (e.g., triggered on an event) is also “Run deployment”-ing on the same cadence. - A second deployment exists with the same cadence. - DST fallback created two runs at the same local wall-clock time. If you can share: - The exact deployment name (
<flow>/<deployment>
) - Output of
prefect deployment schedule ls "<flow>/<deployment>"
- Whether
prefect automation ls
shows any automations with a Run Deployment action for this deployment - A pair of example run IDs and what the UI shows for each run’s “Created by” …I can help pinpoint the exact cause and the cleanest fix. Helpful docs - Schedules overview: Schedules - Automations: Automations - Deployments: Deployments