Skip to content

docs: add documentation for prebuild scheduling feature #18462

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

Merged
merged 7 commits into from
Jun 20, 2025

Conversation

evgeniy-scherbina
Copy link
Contributor

@evgeniy-scherbina evgeniy-scherbina commented Jun 19, 2025

Follow-up to #18126

Changes:

@evgeniy-scherbina evgeniy-scherbina force-pushed the yevhenii/prebuilds-autoscaling-mechanism branch 4 times, most recently from 21c9c1a to b92ae48 Compare June 19, 2025 20:30
@evgeniy-scherbina evgeniy-scherbina force-pushed the yevhenii/prebuilds-autoscaling-mechanism branch from b92ae48 to d26f663 Compare June 19, 2025 20:39
@evgeniy-scherbina evgeniy-scherbina marked this pull request as ready for review June 19, 2025 20:39
@evgeniy-scherbina evgeniy-scherbina requested review from EdwardAngert, dannykopping and ssncferreira and removed request for EdwardAngert June 19, 2025 20:39
@evgeniy-scherbina evgeniy-scherbina changed the title refactor: change calculate-actions function signature docs: add documentation for prebuild scheduling feature Jun 19, 2025
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

Fantastic documentation!

@evgeniy-scherbina evgeniy-scherbina merged commit 8e3022e into main Jun 20, 2025
36 checks passed
@evgeniy-scherbina evgeniy-scherbina deleted the yevhenii/prebuilds-autoscaling-mechanism branch June 20, 2025 14:08
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2025
Copy link
Contributor

@ssncferreira ssncferreira left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 just some small nits

instances = 0 # default to 0 instances

scheduling {
timezone = "UTC" # only a single timezone may be used for simplicity
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add the list of supported timezones

**How scheduling works:**

1. The reconciliation loop evaluates all active schedules every reconciliation interval (`CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL`).
2. The schedule that matches the current time becomes active. Overlapping schedules are disallowed by validation rules.
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit:

Suggested change
2. The schedule that matches the current time becomes active. Overlapping schedules are disallowed by validation rules.
2. The schedule matching the current time is considered active. Overlapping schedules are prevented by validation rules.


1. The reconciliation loop evaluates all active schedules every reconciliation interval (`CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL`).
2. The schedule that matches the current time becomes active. Overlapping schedules are disallowed by validation rules.
3. If no schedules match the current time, the base `instances` count is used.
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit:

Suggested change
3. If no schedules match the current time, the base `instances` count is used.
3. If no schedule matches the current time, the system defaults to the base `instances` count.

Cron expressions follow the format: `* HOUR DOM MONTH DAY-OF-WEEK`

- `*` (minute): Must always be `*` to ensure the schedule covers entire hours rather than specific minute intervals
- `HOUR`: 0-23, range (e.g., 8-18 for 8AM-6:59PM), or `*`
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use the same time interval for consistency:

Suggested change
- `HOUR`: 0-23, range (e.g., 8-18 for 8AM-6:59PM), or `*`
- `HOUR`: 8-18, range (e.g., 8-18 for 8AM-6:59PM), or `*`

instances = 10
}
schedule {
cron = "* 19-23,0-7 * * 1,5" # Evenings and nights (7PM-11:59PM, 12AM-7:59AM, Mon-Fri)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, it is possible to compose multiple hour intervals? Nice 🤩

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants