Repository navigation
Conversation
Member
Author
|
App side: aeonmindai/runcrate_app#169 (adds /api/v1/jobs). Merge and deploy that first, then release this. |
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.
Adds jobs to the CLI: one command on its own GPU machine, its output streamed back, and the machine stopped when the command ends (RUN-486).
Commands
runcrate run --gpu A4000 [--gpu-count 1] [--volume <id>] [--max-runtime 2h] [--template t] [--image img] [--env K=V ...] [--name n] [--region r] [-d/--detach] -- <command...>--is sent as is (-- 'make && ./train'); several are joined with spaces, quoting the ones that need it (-- python -c 'print(1)'runs as typed). Flags stop at the first argument, so the command's own flags pass through.--max-runtime: Go duration or bare minutes, rounded up to whole minutes, 1m to 24h, default 1h (printed with a hint to change it).--env KEYwith no value copies it from the local shell.follow=truelong polls with the cursor), writing each chunk to stdout verbatim; status notes and the final line (status, exit code, runtime, cost) go to stderr.runcrate jobs logs -f <id>andruncrate jobs cancel <id>, exits 0.--detachprints the job ID and returns.runcrate jobs list [--status running,queued] [--limit 20] [-q] [--json]runcrate jobs status <id> [--json]: exit code, error, cost, instance, env keys, volume, timestamps.runcrate jobs logs <id> [-f]: without-f, pages fromafter=0until the cursor stops; with-f, follows likerun(same detach and exit codes).runcrate jobs cancel <id>API client
internal/api/jobs.go:CreateJob,ListJobs,GetJob,GetJobLogs,CancelJob. Follow requests carry a 40 s deadline through the request context; other calls keep the client's timeout.checkHTTPStatusnow returns a typed*StatusError(same message text as before) with code and details. A 402BUDGET_REACHEDreads "this environment's monthly budget is reached; an owner or admin can raise it in the dashboard". A launch failure after creation namesdetails.job_id.Before merging / releasing
feat/jobsin aeonmindai/runcrate_app (RUN-486), which adds/api/v1/jobs.vX.Y.Ztag) after merge soruncrate updateand the installers pick it up.Tests
go vet ./...,go test ./...(also-race -count=5on api and commands) andgo build ./...pass. New tests use httptest fakes: max-runtime parsing, command joining, the create body (gpu_type, max_runtime_minutes, env object, storage_id), the follow loop (chunks in order across responses, cursor honored, null-seq marker printed, retry on 503, stop on 404, stop on done), exit codes per status, and Ctrl-C detach aborting an open long poll without calling/cancel.