Skip to content

Support all schedule types on PrefectDeployment#200

Merged
chrisguidry merged 1 commit intomainfrom
175-support-all-schedule-types
Sep 19, 2025
Merged

Support all schedule types on PrefectDeployment#200
chrisguidry merged 1 commit intomainfrom
175-support-all-schedule-types

Conversation

@chrisguidry
Copy link
Collaborator

Summary

Adds support for cron and rrule schedules to PrefectDeployment, completing support for all Prefect schedule types. The implementation uses Prefect's exact prefect.yaml syntax for seamless migration.

  • Interval schedules: interval: 60, anchor_date: "2024-01-01T00:00:00Z"
  • Cron schedules: cron: "* * * * *", day_or: true
  • RRule schedules: rrule: "RRULE:FREQ=MINUTELY;INTERVAL=1"

Key Changes

  • Flattened schedule structure to match Prefect's API format exactly
  • Comprehensive validation ensuring exactly one schedule type per schedule
  • HTTP status code fix accepting all 2xx responses (fixes 201 Created bug)
  • Enhanced test coverage with 75+ test cases for all schedule types
  • Perfect API compatibility with detailed field mapping comments
  • Updated documentation with local testing procedures

Usage Example

apiVersion: prefect.io/v1
kind: PrefectDeployment
spec:
  deployment:
    schedules:
    # Cron schedule - exactly like prefect.yaml
    - slug: "daily-9am"
      cron: "0 9 * * *"
      timezone: "America/New_York"
      active: true
      
    # RRule schedule - RFC 5545 compliant
    - slug: "weekly-monday"
      rrule: "RRULE:FREQ=WEEKLY;BYDAY=MO"
      timezone: "UTC"
      active: true
      
    # Interval schedule - existing format
    - slug: "hourly"
      interval: 3600
      anchor_date: "2024-01-01T00:00:00Z"
      timezone: "UTC"
      active: true

Testing

  • All 193 unit tests pass
  • End-to-end validation with live Prefect API confirmed
  • HTTP status code handling tested for 200, 201, 202, 204, 4xx, 5xx
  • Example deployment in deploy/samples/deployment_end-to-end.yaml demonstrates all three schedule types

Closes #175

🤖 Generated with Claude Code

Adds support for cron and rrule schedules in addition to existing interval
schedules. The implementation uses Prefect's exact prefect.yaml syntax,
making it seamless for users to migrate existing configurations.

Changes:
- Flatten PrefectSchedule struct to match Prefect's API format exactly
- Add cron and rrule fields with detailed API mapping comments
- Update conversion logic to handle all three schedule types with validation
- Fix HTTP status code handling to accept all 2xx responses (not just 200)
- Add comprehensive test coverage for all schedule types and status codes
- Update deployment_end-to-end.yaml to demonstrate all schedule formats
- Update AGENTS.md with local testing procedures

Schedule syntax now matches Prefect exactly:
- Interval: interval: 60, anchor_date: "2024-01-01T00:00:00Z"
- Cron: cron: "* * * * *", day_or: true
- RRule: rrule: "RRULE:FREQ=MINUTELY;INTERVAL=1"

Fixes #175

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Member

@mitchnielsen mitchnielsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@chrisguidry chrisguidry merged commit 97cc05d into main Sep 19, 2025
8 checks passed
@chrisguidry chrisguidry deleted the 175-support-all-schedule-types branch September 19, 2025 11:59
@mitchnielsen mitchnielsen added the enhancement New feature or request label Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support all of the schedule types on PrefectDeployment

2 participants