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