1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 // State indicates whether a worker is available to do work, and (if
12 // not) whether/when it is expected to become ready.
16 StateUnknown State = iota // might be running a container already
17 StateBooting // instance is booting
18 StateIdle // instance booted, no containers are running
19 StateRunning // instance is running one or more containers
20 StateShutdown // worker has stopped monitoring the instance
21 StateHold // running, but not available to run new containers
26 maxPingFailTime = 10 * time.Minute
29 var stateString = map[State]string{
30 StateUnknown: "unknown",
31 StateBooting: "booting",
33 StateRunning: "running",
34 StateShutdown: "shutdown",
38 // String implements fmt.Stringer.
39 func (s State) String() string {
43 // MarshalText implements encoding.TextMarshaler so a JSON encoding of
44 // map[State]anything uses the state's string representation.
45 func (s State) MarshalText() ([]byte, error) {
46 return []byte(stateString[s]), nil