userconfig

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Shared
	UnknownKey = "unknown"
	NameKey    = "name"
	KindKey    = "kind"

	// API
	ModelKey        = "model"
	TypeKey         = "type"
	PathKey         = "path"
	PredictorKey    = "predictor"
	EndpointKey     = "endpoint"
	SignatureKeyKey = "signature_key"
	TrackerKey      = "tracker"
	ModelTypeKey    = "model_type"
	KeyKey          = "key"
	ConfigKey       = "config"
	PythonPathKey   = "python_path"
	EnvKey          = "env"

	// Compute
	ComputeKey              = "compute"
	MinReplicasKey          = "min_replicas"
	MaxReplicasKey          = "max_replicas"
	InitReplicasKey         = "init_replicas"
	TargetCPUUtilizationKey = "target_cpu_utilization"
	CPUKey                  = "cpu"
	GPUKey                  = "gpu"
	MemKey                  = "mem"
)

Variables

This section is empty.

Functions

func ErrorCannotBeNull

func ErrorCannotBeNull() error

func ErrorDuplicateConfig

func ErrorDuplicateConfig(resourceType resource.Type) error

func ErrorDuplicateEndpoints added in v0.10.0

func ErrorDuplicateEndpoints(endpoint string, apiNames ...string) error

func ErrorDuplicateResourceName

func ErrorDuplicateResourceName(resources ...Resource) error

func ErrorExternalNotFound added in v0.4.1

func ErrorExternalNotFound(path string) error

func ErrorFieldMustBeDefinedForPredictorType added in v0.12.0

func ErrorFieldMustBeDefinedForPredictorType(fieldKey string, predictorType PredictorType) error

func ErrorFieldNotSupportedByPredictorType added in v0.12.0

func ErrorFieldNotSupportedByPredictorType(fieldKey string, predictorType PredictorType) error

func ErrorImplDoesNotExist

func ErrorImplDoesNotExist(path string) error

func ErrorInitReplicasGreaterThanMax added in v0.6.0

func ErrorInitReplicasGreaterThanMax(init int32, max int32) error

func ErrorInitReplicasLessThanMin added in v0.6.0

func ErrorInitReplicasLessThanMin(init int32, min int32) error

func ErrorInvalidTensorFlowDir added in v0.9.0

func ErrorInvalidTensorFlowDir(path string) error

func ErrorMalformedConfig

func ErrorMalformedConfig() error

func ErrorMinReplicasGreaterThanMax added in v0.6.0

func ErrorMinReplicasGreaterThanMax(min int32, max int32) error

func ErrorMissingAppDefinition

func ErrorMissingAppDefinition() error

func ErrorONNXDoesntSupportZip added in v0.8.0

func ErrorONNXDoesntSupportZip() error

func ErrorOneOfPrerequisitesNotDefined

func ErrorOneOfPrerequisitesNotDefined(argName string, prerequisites ...string) error

func ErrorSpecifyAllOrNone

func ErrorSpecifyAllOrNone(vals ...string) error

func ErrorSpecifyOneModelFormatFoundMultiple added in v0.10.0

func ErrorSpecifyOneModelFormatFoundMultiple(found []string, vals ...string) error

func ErrorSpecifyOneModelFormatFoundNone added in v0.10.0

func ErrorSpecifyOneModelFormatFoundNone(vals ...string) error

func ErrorUndefinedResource

func ErrorUndefinedResource(resourceName string, resourceTypes ...resource.Type) error

func GetTFServingExportFromS3Path added in v0.8.0

func GetTFServingExportFromS3Path(path string, awsClient *aws.Client) (string, error)

func Identify

func Identify(r Resource) string

func IsValidTensorFlowS3Directory added in v0.8.0

func IsValidTensorFlowS3Directory(path string, awsClient *aws.Client) bool

IsValidTensorFlowS3Directory checks that the path contains a valid S3 directory for TensorFlow models Must contain the following structure: - 1523423423/ (version prefix, usually a timestamp)

  • saved_model.pb
  • variables/
  • variables.index
  • variables.data-00000-of-00001 (there are a variable number of these files)

func ModelTypeStrings added in v0.8.0

func ModelTypeStrings() []string

func PredictorTypeStrings added in v0.12.0

func PredictorTypeStrings() []string

func ValidatePythonPath added in v0.10.0

func ValidatePythonPath(path string, projectFileMap map[string][]byte) error

Types

type API

type API struct {
	ResourceFields
	Endpoint  *string     `json:"endpoint" yaml:"endpoint"`
	Predictor *Predictor  `json:"predictor" yaml:"predictor"`
	Tracker   *Tracker    `json:"tracker" yaml:"tracker"`
	Compute   *APICompute `json:"compute" yaml:"compute"`
}

func (*API) GetResourceType

func (api *API) GetResourceType() resource.Type

func (*API) UserConfigStr added in v0.5.0

func (api *API) UserConfigStr() string

func (*API) Validate

func (api *API) Validate(deploymentName string, projectFileMap map[string][]byte) error

type APICompute

type APICompute struct {
	MinReplicas          int32         `json:"min_replicas" yaml:"min_replicas"`
	MaxReplicas          int32         `json:"max_replicas" yaml:"max_replicas"`
	InitReplicas         int32         `json:"init_replicas" yaml:"init_replicas"`
	TargetCPUUtilization int32         `json:"target_cpu_utilization" yaml:"target_cpu_utilization"`
	CPU                  k8s.Quantity  `json:"cpu" yaml:"cpu"`
	Mem                  *k8s.Quantity `json:"mem" yaml:"mem"`
	GPU                  int64         `json:"gpu" yaml:"gpu"`
}

func (*APICompute) ID

func (ac *APICompute) ID() string

func (*APICompute) IDWithoutReplicas

func (ac *APICompute) IDWithoutReplicas() string

Only consider CPU, Mem, GPU

func (*APICompute) UserConfigStr added in v0.5.0

func (ac *APICompute) UserConfigStr() string

func (*APICompute) Validate added in v0.6.0

func (ac *APICompute) Validate() error

type APIs

type APIs []*API

func (APIs) Names

func (apis APIs) Names() []string

func (APIs) Validate

func (apis APIs) Validate(deploymentName string, projectFileMap map[string][]byte) error

type App

type App struct {
	Name string `json:"name" yaml:"name"`
}

type Config

type Config struct {
	App  *App `json:"app" yaml:"app"`
	APIs APIs `json:"apis" yaml:"apis"`
}

func New

func New(filePath string, configBytes []byte) (*Config, error)

func ReadConfigFile added in v0.8.0

func ReadConfigFile(filePath string, relativePath string) (*Config, error)

func (*Config) Validate

func (config *Config) Validate(projectBytes []byte) error

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
	ErrDuplicateResourceName
	ErrDuplicateConfig
	ErrMalformedConfig
	ErrMissingAppDefinition
	ErrUndefinedResource
	ErrSpecifyAllOrNone
	ErrSpecifyOnlyOne
	ErrOneOfPrerequisitesNotDefined
	ErrCannotBeNull
	ErrMinReplicasGreaterThanMax
	ErrInitReplicasGreaterThanMax
	ErrInitReplicasLessThanMin
	ErrSpecifyOneModelFormatFoundNone
	ErrSpecifyOneModelFormatFoundMultiple
	ErrImplDoesNotExist
	ErrExternalNotFound
	ErrONNXDoesntSupportZip
	ErrInvalidTensorFlowDir
	ErrFieldMustBeDefinedForPredictorType
	ErrFieldNotSupportedByPredictorType
	ErrDuplicateEndpoints
)

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 ModelType added in v0.8.0

type ModelType int
const (
	UnknownModelType ModelType = iota
	ClassificationModelType
	RegressionModelType
)

func ModelTypeFromString added in v0.8.0

func ModelTypeFromString(s string) ModelType

func (ModelType) MarshalBinary added in v0.8.0

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

MarshalBinary satisfies BinaryMarshaler

func (ModelType) MarshalText added in v0.8.0

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

MarshalText satisfies TextMarshaler

func (ModelType) String added in v0.8.0

func (t ModelType) String() string

func (*ModelType) UnmarshalBinary added in v0.8.0

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

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*ModelType) UnmarshalText added in v0.8.0

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

UnmarshalText satisfies TextUnmarshaler

type Predictor added in v0.10.0

type Predictor struct {
	Type         PredictorType          `json:"type" yaml:"type"`
	Path         string                 `json:"path" yaml:"path"`
	Model        *string                `json:"model" yaml:"model"`
	PythonPath   *string                `json:"python_path" yaml:"python_path"`
	Config       map[string]interface{} `json:"config" yaml:"config"`
	Env          map[string]string      `json:"env" yaml:"env"`
	SignatureKey *string                `json:"signature_key" yaml:"signature_key"`
}

func (*Predictor) ONNXValidate added in v0.12.0

func (predictor *Predictor) ONNXValidate() error

func (*Predictor) PythonValidate added in v0.12.0

func (predictor *Predictor) PythonValidate() error

func (*Predictor) TensorFlowValidate added in v0.12.0

func (predictor *Predictor) TensorFlowValidate() error

func (*Predictor) UserConfigStr added in v0.10.0

func (predictor *Predictor) UserConfigStr() string

func (*Predictor) Validate added in v0.10.0

func (predictor *Predictor) Validate(projectFileMap map[string][]byte) error

type PredictorType added in v0.12.0

type PredictorType int
const (
	UnknownPredictorType PredictorType = iota
	PythonPredictorType
	TensorFlowPredictorType
	ONNXPredictorType
)

func PredictorTypeFromString added in v0.12.0

func PredictorTypeFromString(s string) PredictorType

func (PredictorType) MarshalBinary added in v0.12.0

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

MarshalBinary satisfies BinaryMarshaler

func (PredictorType) MarshalText added in v0.12.0

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

MarshalText satisfies TextMarshaler

func (PredictorType) String added in v0.12.0

func (t PredictorType) String() string

func (*PredictorType) UnmarshalBinary added in v0.12.0

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

UnmarshalBinary satisfies BinaryUnmarshaler Needed for msgpack

func (*PredictorType) UnmarshalText added in v0.12.0

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

UnmarshalText satisfies TextUnmarshaler

type Resource

type Resource interface {
	GetName() string
	GetResourceType() resource.Type
	GetIndex() int
	SetIndex(int)
	GetFilePath() string
	SetFilePath(string)
}

func FindDuplicateResourceName

func FindDuplicateResourceName(resources ...Resource) []Resource

type ResourceFields

type ResourceFields struct {
	Name     string `json:"name" yaml:"name"`
	Index    int    `json:"index" yaml:"-"`
	FilePath string `json:"file_path" yaml:"-"`
}

func (*ResourceFields) GetFilePath

func (resourceFields *ResourceFields) GetFilePath() string

func (*ResourceFields) GetIndex

func (resourceFields *ResourceFields) GetIndex() int

func (*ResourceFields) GetName

func (resourceFields *ResourceFields) GetName() string

func (*ResourceFields) SetFilePath

func (resourceFields *ResourceFields) SetFilePath(filePath string)

func (*ResourceFields) SetIndex

func (resourceFields *ResourceFields) SetIndex(index int)

func (*ResourceFields) UserConfigStr added in v0.5.0

func (resourceFields *ResourceFields) UserConfigStr() string

type Tracker added in v0.8.0

type Tracker struct {
	Key       *string   `json:"key" yaml:"key"`
	ModelType ModelType `json:"model_type" yaml:"model_type"`
}

func (*Tracker) UserConfigStr added in v0.8.0

func (tracker *Tracker) UserConfigStr() string

Jump to

Keyboard shortcuts

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