resource

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VisibleTypes = Types{
		APIType,
	}
)

Functions

func APISavedStatusPtrsEqual

func APISavedStatusPtrsEqual(savedStatus *APISavedStatus, savedStatus2 *APISavedStatus) bool

func DataSavedStatusPtrsEqual

func DataSavedStatusPtrsEqual(savedStatus *DataSavedStatus, savedStatus2 *DataSavedStatus) bool

func DeploymentStatusStrings added in v0.7.0

func DeploymentStatusStrings() []string

func ErrorBeMoreSpecific

func ErrorBeMoreSpecific(vals ...string) error

func ErrorInvalidType

func ErrorInvalidType(invalid string) error

func ErrorNameNotFound

func ErrorNameNotFound(name string) error

func ErrorNameOrTypeNotFound

func ErrorNameOrTypeNotFound(nameOrType string) error

func ErrorNotFound

func ErrorNotFound(name string, resourceType Type) error

func ErrorUnknownKind

func ErrorUnknownKind(name string) error

Types

type APIGroupStatus

type APIGroupStatus struct {
	APIName              string     `json:"api_name"`
	ActiveStatus         *APIStatus `json:"active_status"` // The most recently ready API status, or the ctx API status if it's ready
	Code                 StatusCode `json:"status_code"`
	GroupedReplicaCounts `json:"grouped_replica_counts"`
}

There is one APIGroupStatus per API name/endpoint

func (*APIGroupStatus) GetCode

func (status *APIGroupStatus) GetCode() StatusCode

func (*APIGroupStatus) Message

func (status *APIGroupStatus) Message() string

type APISavedStatus

type APISavedStatus struct {
	BaseSavedStatus
	APIName string `json:"api_name"`
}

func (*APISavedStatus) Copy

func (savedStatus *APISavedStatus) Copy() *APISavedStatus

func (*APISavedStatus) Equal

func (savedStatus *APISavedStatus) Equal(savedStatus2 APISavedStatus) bool

type APIStatus

type APIStatus struct {
	APISavedStatus
	Path                 string `json:"path"`
	MinReplicas          int32  `json:"min_replicas"`
	MaxReplicas          int32  `json:"max_replicas"`
	InitReplicas         int32  `json:"init_replicas"`
	TargetCPUUtilization int32  `json:"target_cpu_utilization"`
	ReplicaCounts        `json:"replica_counts"`
	PodStatuses          []k8s.PodStatus `json:"pod_statuses"`
	Code                 StatusCode      `json:"status_code"`
}

There is one APIStatus per API resource ID (including stale/removed models). There is always an APIStatus for APIs currently in the context.

func (*APIStatus) GetCode

func (status *APIStatus) GetCode() StatusCode

func (*APIStatus) Message

func (status *APIStatus) Message() string

type BaseSavedStatus

type BaseSavedStatus struct {
	ResourceID   string     `json:"resource_id"`
	ResourceType Type       `json:"resource_type"`
	WorkloadID   string     `json:"workload_id"`
	AppName      string     `json:"app_name"`
	Start        *time.Time `json:"start"`
	End          *time.Time `json:"end"`
}

func (*BaseSavedStatus) Copy

func (savedStatus *BaseSavedStatus) Copy() *BaseSavedStatus

func (*BaseSavedStatus) Equal

func (savedStatus *BaseSavedStatus) Equal(savedStatus2 BaseSavedStatus) bool

type DataExitCode

type DataExitCode string
const (
	ExitCodeDataUnknown   DataExitCode = ""
	ExitCodeDataSucceeded DataExitCode = "succeeded"
	ExitCodeDataFailed    DataExitCode = "failed"
	ExitCodeDataKilled    DataExitCode = "killed"
	ExitCodeDataOOM       DataExitCode = "oom"
)

type DataSavedStatus

type DataSavedStatus struct {
	BaseSavedStatus
	ExitCode DataExitCode `json:"exit_code"`
}

func (*DataSavedStatus) Copy

func (savedStatus *DataSavedStatus) Copy() *DataSavedStatus

func (*DataSavedStatus) Equal

func (savedStatus *DataSavedStatus) Equal(savedStatus2 DataSavedStatus) bool

type DataStatus

type DataStatus struct {
	DataSavedStatus
	Code StatusCode `json:"status_code"`
}

func (*DataStatus) GetCode

func (status *DataStatus) GetCode() StatusCode

func (*DataStatus) Message

func (status *DataStatus) Message() string

type DeploymentStatus added in v0.7.0

type DeploymentStatus int
const (
	UnknownDeploymentStatus DeploymentStatus = iota
	UpdatedDeploymentStatus
	UpdatingDeploymentStatus
	ErrorDeploymentStatus
)

func DeploymentStatusFromString added in v0.7.0

func DeploymentStatusFromString(s string) DeploymentStatus

func (DeploymentStatus) MarshalBinary added in v0.7.0

func (t DeploymentStatus) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (DeploymentStatus) MarshalText added in v0.7.0

func (t DeploymentStatus) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (DeploymentStatus) String added in v0.7.0

func (t DeploymentStatus) String() string

func (*DeploymentStatus) UnmarshalBinary added in v0.7.0

func (t *DeploymentStatus) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*DeploymentStatus) UnmarshalText added in v0.7.0

func (t *DeploymentStatus) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type Error

type Error struct {
	Kind ErrorKind
	// contains filtered or unexported fields
}

func (Error) Error

func (e Error) Error() string

type ErrorKind

type ErrorKind int
const (
	ErrUnknown ErrorKind = iota
	ErrUnknownKind
	ErrNotFound
	ErrNameNotFound
	ErrNameOrTypeNotFound
	ErrInvalidType
	ErrBeMoreSpecific
)

func (ErrorKind) MarshalBinary

func (t ErrorKind) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (ErrorKind) MarshalText

func (t ErrorKind) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (ErrorKind) String

func (t ErrorKind) String() string

func (*ErrorKind) UnmarshalBinary

func (t *ErrorKind) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*ErrorKind) UnmarshalText

func (t *ErrorKind) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type GroupedReplicaCounts added in v0.6.0

type GroupedReplicaCounts struct {
	ReadyUpdated       int32 `json:"ready_updated"`       // Updated means the replica is fully up-to-date (compute and model match the API's current resource ID in the context)
	ReadyStaleModel    int32 `json:"ready_stale_model"`   // Stale model means the replica is serving a model which not currently in the context (either it was updated or removed)
	ReadyStaleCompute  int32 `json:"ready_stale_compute"` // Stale compute means the replica is serving the correct model, but the compute request has changed
	FailedUpdated      int32 `json:"failed_updated"`
	FailedStaleModel   int32 `json:"failed_stale_model"`
	FailedStaleCompute int32 `json:"failed_stale_compute"`
	Requested          int32 `json:"requested"`
}

func (*GroupedReplicaCounts) Available added in v0.6.0

func (grc *GroupedReplicaCounts) Available() int32

type ReplicaCounts

type ReplicaCounts struct {
	ReadyUpdatedCompute  int32 `json:"ready_updated_compute"`
	ReadyStaleCompute    int32 `json:"ready_stale_compute"`
	FailedUpdatedCompute int32 `json:"failed_updated_compute"`
	FailedStaleCompute   int32 `json:"failed_stale_compute"`
	K8sRequested         int32 `json:"k8s_requested"` // Number of requested replicas in an active k8s.deployment for this resource ID
}

func (*ReplicaCounts) TotalFailed added in v0.6.0

func (rc *ReplicaCounts) TotalFailed() int32

func (*ReplicaCounts) TotalReady

func (rc *ReplicaCounts) TotalReady() int32

type Status

type Status interface {
	Message() string
	GetCode() StatusCode
}

type StatusCode

type StatusCode int
const (
	StatusUnknown StatusCode = iota

	// Shared statuses
	StatusPending // Resource is pending other non-ready resources
	StatusPendingCompute
	StatusWaiting // Resource can be created based on resource DAG, but hasn't started yet
	StatusSkipped
	StatusError
	StatusParentFailed
	StatusParentKilled
	StatusKilledOOM

	// Data statuses
	StatusRunning
	StatusSucceeded
	StatusKilled

	// API statuses
	StatusLive
	StatusUpdating
	StatusStopping
	StatusStopped
)

func (StatusCode) MarshalBinary

func (code StatusCode) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (StatusCode) MarshalText

func (code StatusCode) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (StatusCode) Message

func (code StatusCode) Message() string

func (StatusCode) SortBucket

func (code StatusCode) SortBucket() int

func (StatusCode) String

func (code StatusCode) String() string

func (*StatusCode) UnmarshalBinary

func (code *StatusCode) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*StatusCode) UnmarshalText

func (code *StatusCode) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

type Type

type Type int
const (
	UnknownType Type = iota // 0
	AppType                 // 1
	APIType                 // 2
)

func TypeFromKindString

func TypeFromKindString(s string) Type

func TypeFromString

func TypeFromString(s string) Type

func VisibleResourceTypeFromPrefix

func VisibleResourceTypeFromPrefix(prefix string) (Type, error)

func (Type) MarshalBinary

func (t Type) MarshalBinary() ([]byte, error)

MarshalBinary satisfies BinaryMarshaler

func (Type) MarshalText

func (t Type) MarshalText() ([]byte, error)

MarshalText satisfies TextMarshaler

func (Type) Plural

func (t Type) Plural() string

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalBinary

func (t *Type) UnmarshalBinary(data []byte) error

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*Type) UnmarshalText

func (t *Type) UnmarshalText(text []byte) error

UnmarshalText satisfies TextUnmarshaler

func (Type) UserFacing added in v0.7.3

func (t Type) UserFacing() string

func (Type) UserFacingPlural added in v0.7.3

func (t Type) UserFacingPlural() string

type Types

type Types []Type

func (Types) Plural

func (ts Types) Plural() string

func (Types) PluralList

func (ts Types) PluralList() []string

func (Types) String

func (ts Types) String() string

func (Types) StringList

func (ts Types) StringList() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL