diff --git a/runner/docs/shim.openapi.yaml b/runner/docs/shim.openapi.yaml index cd00f8f0d..61ef34f32 100644 --- a/runner/docs/shim.openapi.yaml +++ b/runner/docs/shim.openapi.yaml @@ -2,44 +2,46 @@ openapi: 3.1.1 info: title: dstack-shim API - version: &api-version 0.18.31 + version: v2/0.18.34 x-logo: url: https://avatars.githubusercontent.com/u/54146142?s=260 + description: > + ## Versioning + + `dstack-shim` versioning and release cycles are tied to those of `dstack`, meaning that we + cannot use shim version to express shim API versioning. To get around this limitation, we use + two version schemes: + + * shim binary version, the same as the server version, in the form of `MAJOR.MINOR.MICRO`, e.g, + `0.18.33`. This version is exposed via the `/healthcheck` endpoint. Used to discriminate + different API versions (`if shim_version >= x.y.z then api_version = 2 else api_version = 1`) + and detect features within one API version (`if shim_version >= x.y.z then has_x_feature = true`) + + * shim API version (you can think of it as a “generation”), in the form or `vN`, e.g., `v2`. + Diferrent API versions represent _totally different_ APIs. When two such API versions coexist + in the same shim binary (naturally, they should coexist for some time to ensure seamless migration), + we call the older one “Legacy API” and the newer one “Future API”. These versions are not exposed + via API, clients should figure out them via shim binary version servers: - url: http://localhost:10998/api -tags: - - name: &stable-api Stable API - description: > - Stable API should always stay backward (or future, depending on which point of view we are - talking about) compatible, meaning that newer versions of dstack server should be able - to use Stable API of older versions of shim without additional API version negotiation - - name: &future-api Future API - description: > - As of the current version of API, Future API is an upcoming "task-oriented" API, able to - handle more than one task at a time managing machine resources. It is not yet supported - by dstack server - - name: &legacy-api Legacy API - description: > - As of the current version of API, Legacy API is the only API (apart from Stable one) used by - dstack server. It can only process one task at a time and cannot manage (that is, limit) - machine resources consumed by the task - paths: /healthcheck: get: - tags: - - *stable-api summary: Ping and API version negotiation description: > Serves two roles: * as the path implies, it's a healthcheck, although there is no field in the response that - indicate if shim is healthy. Basically, it not is a proper healthcheck but + indicate if shim is healthy. Basically, it not is a proper healthcheck but a basic "ping" method * API version negotiation. Server inspects `version` field to figure out which API features it should use + + **Important**: Since this endpoint is used for negotiation, it should always stay + backward/future compatible, specifically the `version` field + responses: "200": description: "" @@ -50,8 +52,6 @@ paths: /tasks: get: - tags: - - *future-api summary: Get task list description: Returns a list of all tasks known to shim, including terminated ones responses: @@ -62,8 +62,6 @@ paths: schema: $ref: "#/components/schemas/TaskListResponse" post: - tags: - - *future-api summary: Submit and run new task requestBody: required: true @@ -84,8 +82,6 @@ paths: /tasks/{id}: get: - tags: - - *future-api summary: Get task info parameters: - $ref: "#/parameters/taskId" @@ -95,8 +91,6 @@ paths: /tasks/{id}/terminate: post: - tags: - - *future-api summary: Terminate task description: > Stops the task, that is, cancels image pulling if in progress, @@ -130,8 +124,6 @@ paths: /tasks/{id}/remove: post: - tags: - - *future-api summary: Remove task description: > Removes the task from in-memory storage and destroys its associated @@ -152,64 +144,6 @@ paths: description: Internal error, e.g., failed to remove a container $ref: "#/components/responses/PlainTextInternalError" - /submit: - post: - tags: - - *legacy-api - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/LegacySubmitBody" - responses: - "200": - description: "" - content: - text/plain: - schema: - type: string - examples: - - OK - "409": - description: Another task is already submitted (`RunnerStatus` is not `pending`) - content: - text/plain: - schema: - type: string - examples: - - Conflict - - /pull: - get: - tags: - - *legacy-api - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/LegacyPullResponse" - - /stop: - post: - tags: - - *legacy-api - requestBody: - required: false - content: - application/json: - schema: - $ref: "#/components/schemas/LegacyStopBody" - responses: - "200": - description: "" - content: - application/json: - schema: - $ref: "#/components/schemas/LegacyStopResponse" - parameters: taskId: name: id @@ -341,7 +275,7 @@ components: version: type: string examples: - - *api-version + - 0.18.34 required: - service - version @@ -535,144 +469,6 @@ components: Seconds to wait before killing the container. If zero, kill the container immediately (no graceful shutdown) - LegacySubmitBody: - title: shim.api.LegacySubmitBody - type: object - properties: - username: - type: string - default: "" - description: Private container registry username - examples: - - registry-user - password: - type: string - default: "" - description: Private container registry password - examples: - - registry-token - image_name: - type: string - default: "" - examples: - - ubuntu:22.04 - privileged: - type: boolean - default: false - description: > - (since [0.18.18](https://github.com/dstackai/dstack/releases/tag/0.18.18)) - Start container in privileged mode - container_name: - type: string - default: "" - examples: - - horrible-mule-1-0-0 - container_user: - type: string - default: "" - description: > - If not set, the default image user is used. As of 0.18.24, `dstack` always uses `root` - examples: - - root - shm_size: - type: integer - default: 0 - description: > - POSIX shared memory, bytes. - If not set or `0`, the Docker's default is used - examples: - - 1073741824 - public_keys: - type: array - items: - type: string - default: [] - description: > - SSH public keys for `container_user`. As of 0.18.24, `dstack` submits two keys: - project key (generated by the server) and user key (either generated by - the CLI client or provided by the user) - examples: - - ["ssh-rsa project@dstack", "ssh-ed25519 me@laptop"] - ssh_user: - type: string - default: "" - description: > - Instance (host) user for SSH access, either directly (`ssh {run_name}-host`) - or for `ProxyJump`ing inside the container. Ignored if `ssh_key` is not set - examples: - - root - ssh_key: - type: string - default: "" - description: > - SSH public key for access to the instance (host). If set, the key will be added - to the `ssh_users`'s `~/.ssh/authorized_keys` when the run starts and removed - when the run exits. - examples: - - "ssh-ed25519 me@laptop" - mounts: - type: array - items: - $ref: "#/components/schemas/VolumeMountPoint" - default: [] - volumes: - type: array - items: - $ref: "#/components/schemas/VolumeInfo" - default: [] - instance_mounts: - type: array - items: - $ref: "#/components/schemas/InstanceMountPoint" - default: [] - description: (since [0.18.21](https://github.com/dstackai/dstack/releases/tag/0.18.21)) - - LegacyPullResponse: - title: shim.api.LegacyPullResponse - type: object - properties: - state: - allOf: - - $ref: "#/components/schemas/RunnerStatus" - - examples: - - pending - result: - allOf: - - $ref: "#/components/schemas/JobResult" - - examples: - - reason: CONTAINER_EXITED_WITH_ERROR - message: "" - required: - - state - - executor_error - - container_name - - status - - running - - oom_killed - - dead - - exit_code - - error - - result - additionalProperties: false - - LegacyStopBody: - title: shim.api.LegacyStopBody - type: object - properties: - force: - type: boolean - default: false - - LegacyStopResponse: - title: shim.api.LegacyStopResponse - type: object - properties: - state: - $ref: "#/components/schemas/RunnerStatus" - required: - - state - additionalProperties: false - responses: TaskInfo: description: Task info diff --git a/runner/internal/runner/api/http_test.go b/runner/internal/runner/api/http_test.go deleted file mode 100644 index a0572f42d..000000000 --- a/runner/internal/runner/api/http_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package api - -import ( - "context" - "net/http/httptest" - "strings" - "testing" - - common "github.com/dstackai/dstack/runner/internal/api" - "github.com/dstackai/dstack/runner/internal/shim" - "github.com/dstackai/dstack/runner/internal/shim/api" -) - -type DummyRunner struct { - State shim.RunnerStatus - JobResult shim.JobResult -} - -func (ds DummyRunner) GetState() (shim.RunnerStatus, shim.JobResult) { - return ds.State, ds.JobResult -} - -func (ds DummyRunner) Submit(context.Context, shim.TaskConfig) error { - return nil -} - -func (ds DummyRunner) Run(context.Context, string) error { - return nil -} - -func (ds DummyRunner) Terminate(context.Context, string, uint, string, string) error { - return nil -} - -func (ds DummyRunner) Remove(context.Context, string) error { - return nil -} - -func (ds DummyRunner) TaskIDs() []string { - return []string{} -} - -func (ds DummyRunner) TaskInfo(taskID string) shim.TaskInfo { - return shim.TaskInfo{} -} - -func (ds DummyRunner) Resources() shim.Resources { - return shim.Resources{} -} - -func TestHealthcheck(t *testing.T) { - request := httptest.NewRequest("GET", "/api/healthcheck", nil) - responseRecorder := httptest.NewRecorder() - - server := api.NewShimServer(":12345", DummyRunner{}, "0.0.1.dev2") - - f := common.JSONResponseHandler(server.HealthcheckHandler) - f(responseRecorder, request) - - if responseRecorder.Code != 200 { - t.Errorf("Want status '%d', got '%d'", 200, responseRecorder.Code) - } - - expected := "{\"service\":\"dstack-shim\",\"version\":\"0.0.1.dev2\"}" - - if strings.TrimSpace(responseRecorder.Body.String()) != expected { - t.Errorf("Want '%s', got '%s'", expected, responseRecorder.Body.String()) - } -} diff --git a/runner/internal/runner/api/submit_test.go b/runner/internal/runner/api/submit_test.go deleted file mode 100644 index 279d91edc..000000000 --- a/runner/internal/runner/api/submit_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build !race - -package api - -import ( - "net/http/httptest" - "strings" - "testing" - - common "github.com/dstackai/dstack/runner/internal/api" - "github.com/dstackai/dstack/runner/internal/shim" - "github.com/dstackai/dstack/runner/internal/shim/api" -) - -func TestSubmit(t *testing.T) { - request := httptest.NewRequest("POST", "/api/submit", strings.NewReader("{\"image_name\":\"ubuntu\"}")) - responseRecorder := httptest.NewRecorder() - - dummyRunner := DummyRunner{} - dummyRunner.State = shim.Pending - - server := api.NewShimServer(":12340", &dummyRunner, "0.0.1.dev2") - - firstSubmitPost := common.JSONResponseHandler(server.LegacySubmitPostHandler) - firstSubmitPost(responseRecorder, request) - - if responseRecorder.Code != 200 { - t.Errorf("Want status '%d', got '%d'", 200, responseRecorder.Code) - } - - t.Logf("%v", responseRecorder.Result()) - - dummyRunner.State = shim.Pulling - - request = httptest.NewRequest("POST", "/api/submit", strings.NewReader("{\"image_name\":\"ubuntu\"}")) - responseRecorder = httptest.NewRecorder() - - secondSubmitPost := common.JSONResponseHandler(server.LegacySubmitPostHandler) - secondSubmitPost(responseRecorder, request) - - t.Logf("%v", responseRecorder.Result()) - - if responseRecorder.Code != 409 { - t.Errorf("Want status '%d', got '%d'", 409, responseRecorder.Code) - } -} diff --git a/runner/internal/shim/api/api_test.go b/runner/internal/shim/api/api_test.go new file mode 100644 index 000000000..207b4a3cd --- /dev/null +++ b/runner/internal/shim/api/api_test.go @@ -0,0 +1,53 @@ +package api + +import ( + "context" + "sync" + + "github.com/dstackai/dstack/runner/internal/shim" +) + +type DummyRunner struct { + tasks map[string]bool + mu sync.Mutex +} + +func (ds *DummyRunner) Submit(ctx context.Context, cfg shim.TaskConfig) error { + ds.mu.Lock() + defer ds.mu.Unlock() + if _, ok := ds.tasks[cfg.ID]; ok { + return shim.ErrRequest + } + ds.tasks[cfg.ID] = true + return nil +} + +func (ds *DummyRunner) Run(context.Context, string) error { + return nil +} + +func (ds *DummyRunner) Terminate(context.Context, string, uint, string, string) error { + return nil +} + +func (ds *DummyRunner) Remove(context.Context, string) error { + return nil +} + +func (ds *DummyRunner) TaskIDs() []string { + return []string{} +} + +func (ds *DummyRunner) TaskInfo(taskID string) shim.TaskInfo { + return shim.TaskInfo{} +} + +func (ds *DummyRunner) Resources() shim.Resources { + return shim.Resources{} +} + +func NewDummyRunner() *DummyRunner { + return &DummyRunner{ + tasks: map[string]bool{}, + } +} diff --git a/runner/internal/shim/api/http.go b/runner/internal/shim/api/handlers.go similarity index 54% rename from runner/internal/shim/api/http.go rename to runner/internal/shim/api/handlers.go index 6a7fee775..a292c5033 100644 --- a/runner/internal/shim/api/http.go +++ b/runner/internal/shim/api/handlers.go @@ -4,15 +4,12 @@ import ( "context" "errors" "fmt" - "log" "net/http" "github.com/dstackai/dstack/runner/internal/api" "github.com/dstackai/dstack/runner/internal/shim" ) -// Stable API - func (s *ShimServer) HealthcheckHandler(w http.ResponseWriter, r *http.Request) (interface{}, error) { s.mu.RLock() defer s.mu.RUnlock() @@ -23,8 +20,6 @@ func (s *ShimServer) HealthcheckHandler(w http.ResponseWriter, r *http.Request) }, nil } -// Future API - func (s *ShimServer) TaskListHandler(w http.ResponseWriter, r *http.Request) (interface{}, error) { return &TaskListResponse{IDs: s.runner.TaskIDs()}, nil } @@ -92,93 +87,3 @@ func (s *ShimServer) TaskRemoveHandler(w http.ResponseWriter, r *http.Request) ( } return nil, nil } - -// Legacy API - -func (s *ShimServer) LegacySubmitPostHandler(w http.ResponseWriter, r *http.Request) (interface{}, error) { - s.mu.RLock() - defer s.mu.RUnlock() - state, _ := s.runner.GetState() - if state != shim.Pending { - return nil, &api.Error{Status: http.StatusConflict} - } - - var body LegacySubmitBody - if err := api.DecodeJSONBody(w, r, &body, true); err != nil { - log.Println("Failed to decode submit body", "err", err) - return nil, err - } - - taskConfig := shim.TaskConfig{ - ID: shim.LegacyTaskID, - Name: body.ContainerName, - RegistryUsername: body.Username, - RegistryPassword: body.Password, - ImageName: body.ImageName, - ContainerUser: body.ContainerUser, - Privileged: body.Privileged, - GPU: -1, - ShmSize: body.ShmSize, - Volumes: body.Volumes, - VolumeMounts: body.VolumeMounts, - InstanceMounts: body.InstanceMounts, - HostSshUser: body.SshUser, - HostSshKeys: []string{body.SshKey}, - ContainerSshKeys: body.PublicKeys, - } - go func(taskConfig shim.TaskConfig) { - if err := s.runner.Submit(context.Background(), taskConfig); err != nil { - fmt.Printf("failed Submit %v", err) - } - if err := s.runner.Run(context.Background(), taskConfig.ID); err != nil { - fmt.Printf("failed Run %v", err) - } - }(taskConfig) - - return nil, nil -} - -func (s *ShimServer) LegacyPullGetHandler(w http.ResponseWriter, r *http.Request) (interface{}, error) { - s.mu.RLock() - defer s.mu.RUnlock() - - state, jobResult := s.runner.GetState() - - return &LegacyPullResponse{ - State: string(state), - Result: jobResult, - }, nil -} - -func (s *ShimServer) LegacyStopPostHandler(w http.ResponseWriter, r *http.Request) (interface{}, error) { - s.mu.RLock() - defer s.mu.RUnlock() - - state, _ := s.runner.GetState() - if state == shim.Pending { - return &LegacyStopResponse{ - State: string(state), - }, nil - } - - var body LegacyStopBody - if err := api.DecodeJSONBody(w, r, &body, true); err != nil { - log.Println("Failed to decode submit stop body", "err", err) - return nil, err - } - - var timeout uint - if body.Force { - timeout = 0 - } else { - timeout = 10 // Docker default value - } - if err := s.runner.Terminate(r.Context(), shim.LegacyTaskID, timeout, "", ""); err != nil { - log.Println("Failed to terminate", "err", err) - } - - state, _ = s.runner.GetState() - return &LegacyStopResponse{ - State: string(state), - }, nil -} diff --git a/runner/internal/shim/api/handlers_test.go b/runner/internal/shim/api/handlers_test.go new file mode 100644 index 000000000..8cc606308 --- /dev/null +++ b/runner/internal/shim/api/handlers_test.go @@ -0,0 +1,49 @@ +package api + +import ( + "net/http/httptest" + "strings" + "testing" + + common "github.com/dstackai/dstack/runner/internal/api" +) + +func TestHealthcheck(t *testing.T) { + request := httptest.NewRequest("GET", "/api/healthcheck", nil) + responseRecorder := httptest.NewRecorder() + + server := NewShimServer(":12345", NewDummyRunner(), "0.0.1.dev2") + + f := common.JSONResponseHandler(server.HealthcheckHandler) + f(responseRecorder, request) + + if responseRecorder.Code != 200 { + t.Errorf("Want status '%d', got '%d'", 200, responseRecorder.Code) + } + + expected := "{\"service\":\"dstack-shim\",\"version\":\"0.0.1.dev2\"}" + + if strings.TrimSpace(responseRecorder.Body.String()) != expected { + t.Errorf("Want '%s', got '%s'", expected, responseRecorder.Body.String()) + } +} + +func TestTaskSubmit(t *testing.T) { + server := NewShimServer(":12340", NewDummyRunner(), "0.0.1.dev2") + + request := httptest.NewRequest("POST", "/api/tasks", strings.NewReader(`{"image_name":"ubuntu"}`)) + responseRecorder := httptest.NewRecorder() + firstSubmitPost := common.JSONResponseHandler(server.TaskSubmitHandler) + firstSubmitPost(responseRecorder, request) + if responseRecorder.Code != 200 { + t.Errorf("Want status '%d', got '%d'", 200, responseRecorder.Code) + } + + request = httptest.NewRequest("POST", "/api/tasks", strings.NewReader(`{"image_name":"ubuntu"}`)) + responseRecorder = httptest.NewRecorder() + secondSubmitPost := common.JSONResponseHandler(server.TaskSubmitHandler) + secondSubmitPost(responseRecorder, request) + if responseRecorder.Code != 409 { + t.Errorf("Want status '%d', got '%d'", 409, responseRecorder.Code) + } +} diff --git a/runner/internal/shim/api/schemas.go b/runner/internal/shim/api/schemas.go index 8a402ee23..731618268 100644 --- a/runner/internal/shim/api/schemas.go +++ b/runner/internal/shim/api/schemas.go @@ -2,15 +2,11 @@ package api import "github.com/dstackai/dstack/runner/internal/shim" -// Stable API - type HealthcheckResponse struct { Service string `json:"service"` Version string `json:"version"` } -// Future API - type TaskListResponse struct { IDs []string `json:"ids"` } @@ -33,34 +29,3 @@ type TaskTerminateRequest struct { TerminationMessage string `json:"termination_message"` Timeout uint `json:"timeout"` } - -// Legacy API - -type LegacySubmitBody struct { - Username string `json:"username"` - Password string `json:"password"` - ImageName string `json:"image_name"` - Privileged bool `json:"privileged"` - ContainerName string `json:"container_name"` - ContainerUser string `json:"container_user"` - ShmSize int64 `json:"shm_size"` - PublicKeys []string `json:"public_keys"` - SshUser string `json:"ssh_user"` - SshKey string `json:"ssh_key"` - VolumeMounts []shim.VolumeMountPoint `json:"mounts"` - Volumes []shim.VolumeInfo `json:"volumes"` - InstanceMounts []shim.InstanceMountPoint `json:"instance_mounts"` -} - -type LegacyPullResponse struct { - State string `json:"state"` - Result shim.JobResult `json:"result"` -} - -type LegacyStopBody struct { - Force bool `json:"force"` -} - -type LegacyStopResponse struct { - State string `json:"state"` -} diff --git a/runner/internal/shim/api/server.go b/runner/internal/shim/api/server.go index 89bd74fd0..2c2e3e62c 100644 --- a/runner/internal/shim/api/server.go +++ b/runner/internal/shim/api/server.go @@ -18,8 +18,6 @@ type TaskRunner interface { Resources() shim.Resources TaskIDs() []string TaskInfo(taskID string) shim.TaskInfo - - GetState() (shim.RunnerStatus, shim.JobResult) } type ShimServer struct { @@ -44,21 +42,13 @@ func NewShimServer(address string, runner TaskRunner, version string) *ShimServe version: version, } - // Stable API // The healthcheck endpoint should stay backward compatible, as it is used for negotiation r.AddHandler("GET", "/api/healthcheck", s.HealthcheckHandler) - - // Future API r.AddHandler("GET", "/api/tasks", s.TaskListHandler) r.AddHandler("GET", "/api/tasks/{id}", s.TaskInfoHandler) r.AddHandler("POST", "/api/tasks", s.TaskSubmitHandler) r.AddHandler("POST", "/api/tasks/{id}/terminate", s.TaskTerminateHandler) r.AddHandler("POST", "/api/tasks/{id}/remove", s.TaskRemoveHandler) - // Legacy API - r.AddHandler("POST", "/api/submit", s.LegacySubmitPostHandler) - r.AddHandler("GET", "/api/pull", s.LegacyPullGetHandler) - r.AddHandler("POST", "/api/stop", s.LegacyStopPostHandler) - return s } diff --git a/runner/internal/shim/docker.go b/runner/internal/shim/docker.go index 4ba13dbbc..df0bd988b 100644 --- a/runner/internal/shim/docker.go +++ b/runner/internal/shim/docker.go @@ -48,11 +48,6 @@ const ( LabelValueTrue = "true" ) -type JobResult struct { - Reason string `json:"reason"` - ReasonMessage string `json:"reason_message"` -} - type DockerRunner struct { client *docker.Client dockerParams DockerParameters @@ -231,19 +226,6 @@ func (d *DockerRunner) Submit(ctx context.Context, cfg TaskConfig) error { return tracerr.Errorf("%w: empty task Name", ErrRequest) } task := NewTaskFromConfig(cfg) - // For legacy API compatibility, since LegacyTaskID is the same for all tasks - if task.ID == LegacyTaskID { - if currentTask, ok := d.tasks.Get(LegacyTaskID); ok { - if currentTask.Status != TaskStatusTerminated { - if err := d.Terminate(ctx, LegacyTaskID, 0, "", ""); err != nil { - log.Printf("failed to terminate task: %v", err) - } - } - if err := d.Remove(ctx, LegacyTaskID); err != nil { - log.Printf("failed to remove task: %v", err) - } - } - } if ok := d.tasks.Add(task); !ok { return tracerr.Errorf("%w: task %s is already submitted", ErrRequest, task.ID) } @@ -263,7 +245,7 @@ func (d *DockerRunner) Run(ctx context.Context, taskID string) error { defer func() { if err := d.tasks.Update(task); err != nil { - if currentTask, ok := d.tasks.Get(LegacyTaskID); ok && currentTask.Status != task.Status { + if currentTask, ok := d.tasks.Get(task.ID); ok && currentTask.Status != task.Status { // ignore error if task is gone or status has not changed, e.g., terminated -> terminated log.Printf("failed to update task %s: %v", task.ID, err) } @@ -487,35 +469,6 @@ func (d *DockerRunner) remove(ctx context.Context, task *Task) (err error) { return nil } -func (d *DockerRunner) GetState() (RunnerStatus, JobResult) { - if task, ok := d.tasks.Get(LegacyTaskID); ok { - return getLegacyStatus(task), JobResult{ - Reason: task.TerminationReason, - ReasonMessage: task.TerminationMessage, - } - } - return Pending, JobResult{} -} - -func getLegacyStatus(task Task) RunnerStatus { - switch task.Status { - case TaskStatusPending: - return Pulling - case TaskStatusPreparing: - return Pulling - case TaskStatusPulling: - return Pulling - case TaskStatusCreating: - return Creating - case TaskStatusRunning: - return Running - case TaskStatusTerminated: - return Pending - } - // should not reach here - return "" -} - func getBackend(backendType string) (backends.Backend, error) { switch backendType { case "aws": diff --git a/runner/internal/shim/errs.go b/runner/internal/shim/errs.go index 237d2616d..92f99fe72 100644 --- a/runner/internal/shim/errs.go +++ b/runner/internal/shim/errs.go @@ -30,6 +30,4 @@ var ( ErrRequest = errors.New("request error") // referenced object does not exist ErrNotFound = errors.New("not found") - // object already exists (conflict) - ErrAlreadyExists = errors.New("already exists") ) diff --git a/runner/internal/shim/models.go b/runner/internal/shim/models.go index 8733a53e7..120b8b192 100644 --- a/runner/internal/shim/models.go +++ b/runner/internal/shim/models.go @@ -84,6 +84,3 @@ type TaskInfo struct { ContainerID string GpuIDs []string } - -// a surrogate ID used for tasks submitted via legacy API -const LegacyTaskID = "00000000-0000-0000-0000-000000000000" diff --git a/runner/internal/shim/states.go b/runner/internal/shim/states.go deleted file mode 100644 index e12f66041..000000000 --- a/runner/internal/shim/states.go +++ /dev/null @@ -1,10 +0,0 @@ -package shim - -type RunnerStatus string - -const ( - Pending RunnerStatus = "pending" - Pulling RunnerStatus = "pulling" - Creating RunnerStatus = "creating" - Running RunnerStatus = "running" -)