Repository navigation
feat(schedules): runcrate schedule (start instances or jobs later, once or on cron) - #5
Merged
Merged
Conversation
heydryft
force-pushed
the
feat/schedules
branch
from
October 20, 2026 12:37
a19e627 to
0c23a69
Compare
…delete, run-now Start an instance or a job later, once (--at) or on a recurring --cron in an IANA zone, against /api/v1/schedules. A command after -- makes it a job; otherwise it starts an instance. --max-runtime is required for both. --at wall times are read in --tz (default this machine's zone) and converted across DST: a skipped time moves forward by the gap, a repeated time runs the first time. Reuses the instance and job create builders and flags by extracting buildInstanceRequest, addInstanceOnlyFlags and addJobOnlyFlags.
Add run_as and run_as_credential to the Schedule type, show how a schedule launches in schedule get, and show credential_revoked as 'paused: key revoked'.
heydryft
force-pushed
the
feat/schedules
branch
from
October 20, 2026 13:24
0c23a69 to
3480198
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it adds
runcrate schedule(aliasschedules), against/api/v1/schedules:create --at '<time>' | --cron '<5 fields>' [--tz <IANA>] [--name] [--overlap skip|allow]with the instance create flags (--gpu,--gpu-count,--region,--template,--volume,--type-id,--idle-stop,--max-runtime) or a job command after--with the job flags (--volume,--image,--env).jobwhen a command follows--, elseinstance(which needs--name, likeinstances create).--max-runtimeis required for both kinds and refused locally when missing (instance 5m to 168h, job 1m to 24h, same parsers asinstances createandrun).--atwithout an offset is wall time in--tz;--tzdefaults to this machine's IANA zone ($TZ, then/etc/localtime) for--atand--cron. The CLI sendsrun_atas a UTC instant plustimezone. DST is handled without offset math: a skipped time moves forward by the gap (with a note on stderr), a repeated time uses the first one, matching the server's cron rule. Zone data is embedded (time/tzdata) so--tzworks on Windows.--idle-stop/--type-idon a job,--image/--envon an instance,--overlapwith--at, both or neither of--at/--cron, non 5-field cron).list [-q]table: ID, NAME, KIND, WHEN (cron + tz, oronce <time> (tz)), NEXT RUN (local time), LAST RESULT, ENABLED.get <id>,pause <id>(PATCHenabled:false),resume <id>(enabled:true),run-now <id>,delete <id>(asks[y/N]unless-y/--yes; without a terminal it asks for--yes).--jsonon the group for every subcommand, likeinstancesandjobs.api.APIErroras<message> (HTTP <status>);run-now's 402 BUDGET_REACHED prints the same budget message asinstances create.Refactors for reuse (no behaviour change)
buildInstanceRequestandaddInstanceOnlyFlagsextracted frominstances create;addJobOnlyFlags(--image,--env) extracted fromrun.schedule createbuilds itsspecwith these andbuildJobRequest, and reusesformatMinutes,parseMinutesFlagandparseMaxRuntime.newTableTo(w)so the list table can be rendered in tests.Based on
main(9bbf731, includes #1 to #4).How it was tested
go vet ./...,go test ./...(all packages pass), and the CI cross-compile for the five targets. New tests ininternal/commands/schedule_test.go, all offline withhttptestfakes:--atconversion in Europe/London and America/New_York incl. spring-forward gaps (2026-03-29 01:30 London lands at 02:30 BST) and fall-back repeats (first occurrence), explicit offsets, past and malformed times.$TZdefault zone and unknown--tz.--max-runtimefor each kind.Smoke-run of the built binary with an empty HOME (no credentials, no live API calls): help output, the missing
--max-runtimerefusal, and the DST note.Pairs with the runcrate_app schedules PR (feat/launch-schedules).