Merge branch 'master' into 10231-keep-cache-runtime-constraints
[arvados.git] / sdk / go / arvados / container.go
1 package arvados
2
3 // Container is an arvados#container resource.
4 type Container struct {
5         UUID               string             `json:"uuid"`
6         Command            []string           `json:"command"`
7         ContainerImage     string             `json:"container_image"`
8         Cwd                string             `json:"cwd"`
9         Environment        map[string]string  `json:"environment"`
10         LockedByUUID       string             `json:"locked_by_uuid"`
11         Mounts             map[string]Mount   `json:"mounts"`
12         Output             string             `json:"output"`
13         OutputPath         string             `json:"output_path"`
14         Priority           int                `json:"priority"`
15         RuntimeConstraints RuntimeConstraints `json:"runtime_constraints"`
16         State              ContainerState     `json:"state"`
17 }
18
19 // Mount is special behavior to attach to a filesystem path or device.
20 type Mount struct {
21         Kind             string      `json:"kind"`
22         Writable         bool        `json:"writable"`
23         PortableDataHash string      `json:"portable_data_hash"`
24         UUID             string      `json:"uuid"`
25         DeviceType       string      `json:"device_type"`
26         Path             string      `json:"path"`
27         Content          interface{} `json:"content"`
28 }
29
30 // RuntimeConstraints specify a container's compute resources (RAM,
31 // CPU) and network connectivity.
32 type RuntimeConstraints struct {
33         API          *bool
34         RAM          int      `json:"ram"`
35         VCPUs        int      `json:"vcpus"`
36         KeepCacheRAM int      `json:"keep_cache_ram"`
37         Partition    []string `json:"partition"`
38 }
39
40 // ContainerList is an arvados#containerList resource.
41 type ContainerList struct {
42         Items          []Container `json:"items"`
43         ItemsAvailable int         `json:"items_available"`
44         Offset         int         `json:"offset"`
45         Limit          int         `json:"limit"`
46 }
47
48 // ContainerState is a string corresponding to a valid Container state.
49 type ContainerState string
50
51 const (
52         ContainerStateQueued    = ContainerState("Queued")
53         ContainerStateLocked    = ContainerState("Locked")
54         ContainerStateRunning   = ContainerState("Running")
55         ContainerStateComplete  = ContainerState("Complete")
56         ContainerStateCancelled = ContainerState("Cancelled")
57 )