Skip to content
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

Merged
merged 19 commits into from
Nov 25, 2024
Merged

Conversation

mitchnielsen
Copy link
Contributor

@mitchnielsen mitchnielsen commented Nov 20, 2024

Summary

Closes https://linear.app/prefect/issue/PLA-440/deployments-support-schedules

References

Notes

  • The API offers the ability to manage schedules via the Deployments endpoints, but there's also endpoints specifically for Deployment Schedules. This would let us make Deployment Schedules a separate resource, but it may not be ideal since there's no endpoint for getting a specific Schedule - which we'd need to refresh state for a single Deployment Schedule resource in Terraform.
  • Here is the gist where I tested schedules on the Deployment resource.

@mitchnielsen mitchnielsen self-assigned this Nov 20, 2024
@mitchnielsen mitchnielsen changed the title Deployments support schedule Deployments: support schedule Nov 20, 2024
One schedule, not a list of them.
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.
Comment on lines +375 to +382
//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
}
Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@mitchnielsen mitchnielsen merged commit 9f0be9b into main Nov 25, 2024
7 checks passed
@mitchnielsen mitchnielsen deleted the deployments-support-schedule branch November 25, 2024 14:59
@parkedwards parkedwards added the enhancement New feature or request label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs enhancement New feature or request feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants