13219: Moves time out code from dispatch to crunch-run
[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         Preemptible bool     `json:"preemptible"`
57         MaxRunTime  int      `json:"max_run_time"`
58 }
59
60 // ContainerList is an arvados#containerList resource.
61 type ContainerList struct {
62         Items          []Container `json:"items"`
63         ItemsAvailable int         `json:"items_available"`
64         Offset         int         `json:"offset"`
65         Limit          int         `json:"limit"`
66 }
67
68 // ContainerState is a string corresponding to a valid Container state.
69 type ContainerState string
70
71 const (
72         ContainerStateQueued    = ContainerState("Queued")
73         ContainerStateLocked    = ContainerState("Locked")
74         ContainerStateRunning   = ContainerState("Running")
75         ContainerStateComplete  = ContainerState("Complete")
76         ContainerStateCancelled = ContainerState("Cancelled")
77 )