19620: Remove old "v1" S3 keepstore driver.
[arvados.git] / sdk / go / arvados / container.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 import "time"
8
9 // Container is an arvados#container resource.
10 type Container struct {
11         UUID                      string                 `json:"uuid"`
12         Etag                      string                 `json:"etag"`
13         CreatedAt                 time.Time              `json:"created_at"`
14         ModifiedByClientUUID      string                 `json:"modified_by_client_uuid"`
15         ModifiedByUserUUID        string                 `json:"modified_by_user_uuid"`
16         ModifiedAt                time.Time              `json:"modified_at"`
17         Command                   []string               `json:"command"`
18         ContainerImage            string                 `json:"container_image"`
19         Cwd                       string                 `json:"cwd"`
20         Environment               map[string]string      `json:"environment"`
21         LockedByUUID              string                 `json:"locked_by_uuid"`
22         Mounts                    map[string]Mount       `json:"mounts"`
23         Output                    string                 `json:"output"`
24         OutputPath                string                 `json:"output_path"`
25         Priority                  int64                  `json:"priority"`
26         RuntimeConstraints        RuntimeConstraints     `json:"runtime_constraints"`
27         State                     ContainerState         `json:"state"`
28         SchedulingParameters      SchedulingParameters   `json:"scheduling_parameters"`
29         ExitCode                  int                    `json:"exit_code"`
30         RuntimeStatus             map[string]interface{} `json:"runtime_status"`
31         StartedAt                 *time.Time             `json:"started_at"`  // nil if not yet started
32         FinishedAt                *time.Time             `json:"finished_at"` // nil if not yet finished
33         GatewayAddress            string                 `json:"gateway_address"`
34         InteractiveSessionStarted bool                   `json:"interactive_session_started"`
35         OutputStorageClasses      []string               `json:"output_storage_classes"`
36         RuntimeUserUUID           string                 `json:"runtime_user_uuid"`
37         RuntimeAuthScopes         []string               `json:"runtime_auth_scopes"`
38         RuntimeToken              string                 `json:"runtime_token"`
39         AuthUUID                  string                 `json:"auth_uuid"`
40         Log                       string                 `json:"log"`
41         Cost                      float64                `json:"cost"`
42         SubrequestsCost           float64                `json:"subrequests_cost"`
43 }
44
45 // ContainerRequest is an arvados#container_request resource.
46 type ContainerRequest struct {
47         UUID                    string                 `json:"uuid"`
48         OwnerUUID               string                 `json:"owner_uuid"`
49         CreatedAt               time.Time              `json:"created_at"`
50         ModifiedByClientUUID    string                 `json:"modified_by_client_uuid"`
51         ModifiedByUserUUID      string                 `json:"modified_by_user_uuid"`
52         ModifiedAt              time.Time              `json:"modified_at"`
53         Href                    string                 `json:"href"`
54         Etag                    string                 `json:"etag"`
55         Name                    string                 `json:"name"`
56         Description             string                 `json:"description"`
57         Properties              map[string]interface{} `json:"properties"`
58         State                   ContainerRequestState  `json:"state"`
59         RequestingContainerUUID string                 `json:"requesting_container_uuid"`
60         ContainerUUID           string                 `json:"container_uuid"`
61         ContainerCountMax       int                    `json:"container_count_max"`
62         Mounts                  map[string]Mount       `json:"mounts"`
63         RuntimeConstraints      RuntimeConstraints     `json:"runtime_constraints"`
64         SchedulingParameters    SchedulingParameters   `json:"scheduling_parameters"`
65         ContainerImage          string                 `json:"container_image"`
66         Environment             map[string]string      `json:"environment"`
67         Cwd                     string                 `json:"cwd"`
68         Command                 []string               `json:"command"`
69         OutputPath              string                 `json:"output_path"`
70         OutputName              string                 `json:"output_name"`
71         OutputTTL               int                    `json:"output_ttl"`
72         Priority                int                    `json:"priority"`
73         UseExisting             bool                   `json:"use_existing"`
74         LogUUID                 string                 `json:"log_uuid"`
75         OutputUUID              string                 `json:"output_uuid"`
76         RuntimeToken            string                 `json:"runtime_token"`
77         ExpiresAt               time.Time              `json:"expires_at"`
78         Filters                 []Filter               `json:"filters"`
79         ContainerCount          int                    `json:"container_count"`
80         OutputStorageClasses    []string               `json:"output_storage_classes"`
81         OutputProperties        map[string]interface{} `json:"output_properties"`
82         CumulativeCost          float64                `json:"cumulative_cost"`
83 }
84
85 // Mount is special behavior to attach to a filesystem path or device.
86 type Mount struct {
87         Kind              string      `json:"kind"`
88         Writable          bool        `json:"writable"`
89         PortableDataHash  string      `json:"portable_data_hash"`
90         UUID              string      `json:"uuid"`
91         DeviceType        string      `json:"device_type"`
92         Path              string      `json:"path"`
93         Content           interface{} `json:"content"`
94         ExcludeFromOutput bool        `json:"exclude_from_output"`
95         Capacity          int64       `json:"capacity"`
96         Commit            string      `json:"commit"`          // only if kind=="git_tree"
97         RepositoryName    string      `json:"repository_name"` // only if kind=="git_tree"
98         GitURL            string      `json:"git_url"`         // only if kind=="git_tree"
99 }
100
101 type CUDARuntimeConstraints struct {
102         DriverVersion      string `json:"driver_version"`
103         HardwareCapability string `json:"hardware_capability"`
104         DeviceCount        int    `json:"device_count"`
105 }
106
107 // RuntimeConstraints specify a container's compute resources (RAM,
108 // CPU) and network connectivity.
109 type RuntimeConstraints struct {
110         API           bool                   `json:"API"`
111         RAM           int64                  `json:"ram"`
112         VCPUs         int                    `json:"vcpus"`
113         KeepCacheRAM  int64                  `json:"keep_cache_ram"`
114         KeepCacheDisk int64                  `json:"keep_cache_disk"`
115         CUDA          CUDARuntimeConstraints `json:"cuda"`
116 }
117
118 // SchedulingParameters specify a container's scheduling parameters
119 // such as Partitions
120 type SchedulingParameters struct {
121         Partitions  []string `json:"partitions"`
122         Preemptible bool     `json:"preemptible"`
123         MaxRunTime  int      `json:"max_run_time"`
124         Supervisor  bool     `json:"supervisor"`
125 }
126
127 // ContainerList is an arvados#containerList resource.
128 type ContainerList struct {
129         Items          []Container `json:"items"`
130         ItemsAvailable int         `json:"items_available"`
131         Offset         int         `json:"offset"`
132         Limit          int         `json:"limit"`
133 }
134
135 // ContainerRequestList is an arvados#containerRequestList resource.
136 type ContainerRequestList struct {
137         Items          []ContainerRequest `json:"items"`
138         ItemsAvailable int                `json:"items_available"`
139         Offset         int                `json:"offset"`
140         Limit          int                `json:"limit"`
141 }
142
143 // ContainerState is a string corresponding to a valid Container state.
144 type ContainerState string
145
146 const (
147         ContainerStateQueued    = ContainerState("Queued")
148         ContainerStateLocked    = ContainerState("Locked")
149         ContainerStateRunning   = ContainerState("Running")
150         ContainerStateComplete  = ContainerState("Complete")
151         ContainerStateCancelled = ContainerState("Cancelled")
152 )
153
154 // ContainerRequestState is a string corresponding to a valid Container Request state.
155 type ContainerRequestState string
156
157 const (
158         ContainerRequestStateUncomitted = ContainerRequestState("Uncommitted")
159         ContainerRequestStateCommitted  = ContainerRequestState("Committed")
160         ContainerRequestStateFinal      = ContainerRequestState("Final")
161 )