Merge branch '12863-wb-cr-status'
[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 // Container is an arvados#container resource.
8 type Container struct {
9         UUID                 string               `json:"uuid"`
10         Command              []string             `json:"command"`
11         ContainerImage       string               `json:"container_image"`
12         Cwd                  string               `json:"cwd"`
13         Environment          map[string]string    `json:"environment"`
14         LockedByUUID         string               `json:"locked_by_uuid"`
15         Mounts               map[string]Mount     `json:"mounts"`
16         Output               string               `json:"output"`
17         OutputPath           string               `json:"output_path"`
18         Priority             int                  `json:"priority"`
19         RuntimeConstraints   RuntimeConstraints   `json:"runtime_constraints"`
20         State                ContainerState       `json:"state"`
21         SchedulingParameters SchedulingParameters `json:"scheduling_parameters"`
22 }
23
24 // Mount is special behavior to attach to a filesystem path or device.
25 type Mount struct {
26         Kind              string      `json:"kind"`
27         Writable          bool        `json:"writable"`
28         PortableDataHash  string      `json:"portable_data_hash"`
29         UUID              string      `json:"uuid"`
30         DeviceType        string      `json:"device_type"`
31         Path              string      `json:"path"`
32         Content           interface{} `json:"content"`
33         ExcludeFromOutput bool        `json:"exclude_from_output"`
34         Capacity          int64       `json:"capacity"`
35         Commit            string      `json:"commit"`          // only if kind=="git_tree"
36         RepositoryName    string      `json:"repository_name"` // only if kind=="git_tree"
37         GitURL            string      `json:"git_url"`         // only if kind=="git_tree"
38 }
39
40 // RuntimeConstraints specify a container's compute resources (RAM,
41 // CPU) and network connectivity.
42 type RuntimeConstraints struct {
43         API          *bool
44         RAM          int64 `json:"ram"`
45         VCPUs        int   `json:"vcpus"`
46         KeepCacheRAM int64 `json:"keep_cache_ram"`
47 }
48
49 // SchedulingParameters specify a container's scheduling parameters
50 // such as Partitions
51 type SchedulingParameters struct {
52         Partitions []string `json:"partitions"`
53 }
54
55 // ContainerList is an arvados#containerList resource.
56 type ContainerList struct {
57         Items          []Container `json:"items"`
58         ItemsAvailable int         `json:"items_available"`
59         Offset         int         `json:"offset"`
60         Limit          int         `json:"limit"`
61 }
62
63 // ContainerState is a string corresponding to a valid Container state.
64 type ContainerState string
65
66 const (
67         ContainerStateQueued    = ContainerState("Queued")
68         ContainerStateLocked    = ContainerState("Locked")
69         ContainerStateRunning   = ContainerState("Running")
70         ContainerStateComplete  = ContainerState("Complete")
71         ContainerStateCancelled = ContainerState("Cancelled")
72 )