-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deployments: support schedule
#304
Conversation
Initial implementation of schedules support by implementing it directly in the deployment resource.
schedule
One schedule, not a list of them.
- Copy schedule to model - Validate schedule length of 1 - Add missing fields in payloads
I was seeing an issue where my create payload would set active=false, but the API would return a schedule where active=true. I noticed that active=true is the default in the Prefect API, so I suspect something about that conflict with Go's default value for active (false) has something to do with it. Changing this value to a pointer, and passing ValueBoolPointer in the payloads and state configuration seems to fix the problem. This definitely needs further thought.
This will use the state when the ID is not in the plan, which it won't ever be because it's not configured by the user. This way we don't have to get the current state just to pull the schedule ID.
//nolint:ireturn // required to return a diagnostic | ||
func validateSchedules(schedules []*api.DeploymentSchedule) diag.Diagnostic { | ||
if len(schedules) != 1 { | ||
return diag.NewErrorDiagnostic("Unsupported number of schedules", fmt.Sprintf("Expected 1 schedule, got %d. Only one schedule is supported.", len(schedules))) | ||
} | ||
|
||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to limit to 1 schedule at a time for now. Opened https://linear.app/prefect/issue/PLA-772/deployments-support-multiple-schedules to investigate support for multiple schedules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note to the docs as well
622a832
to
a5eb780
Compare
Summary
Closes https://linear.app/prefect/issue/PLA-440/deployments-support-schedules
References
Notes