server

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright 2022 IBM Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterConfiguration

type AdapterConfiguration struct {
	Port                     int
	OvmsPort                 int
	OvmsContainerMemReqBytes int
	OvmsMemBufferBytes       int
	CapacityInBytes          int
	MaxLoadingConcurrency    int
	ModelLoadingTimeoutMS    int
	DefaultModelSizeInBytes  int
	ModelSizeMultiplier      float64
	RuntimeVersion           string
	LimitModelConcurrency    int // 0 means no limit (default)
	RootModelDir             string
	UseEmbeddedPuller        bool

	// OVMS adapter specific
	ModelConfigFile  string
	BatchWaitTimeMin time.Duration
	BatchWaitTimeMax time.Duration
	ReloadTimeout    time.Duration
}

func GetAdapterConfigurationFromEnv

func GetAdapterConfigurationFromEnv(log logr.Logger) (*AdapterConfiguration, error)

type ModelManagerConfig

type ModelManagerConfig struct {
	BatchWaitTimeMin time.Duration
	BatchWaitTimeMax time.Duration

	HttpClientMaxConns int
	ReloadTimeout      time.Duration

	ModelConfigFilePerms fs.FileMode

	RequestChannelSize int
}

type OvmsAdapterServer

type OvmsAdapterServer struct {
	ModelManager  *OvmsModelManager
	Puller        *puller.Puller
	AdapterConfig *AdapterConfiguration
	Log           logr.Logger

	// embed generated Unimplemented type for forward-compatibility for gRPC
	mmesh.UnimplementedModelRuntimeServer
}

func NewOvmsAdapterServer

func NewOvmsAdapterServer(runtimePort int, config *AdapterConfiguration, log logr.Logger) *OvmsAdapterServer

func (*OvmsAdapterServer) LoadModel

func (*OvmsAdapterServer) RuntimeStatus

func (*OvmsAdapterServer) UnloadModel

type OvmsConfigErrorResponse

type OvmsConfigErrorResponse struct {
	Error string `json:"error"`
}

type OvmsConfigResponse

type OvmsConfigResponse map[string]OvmsModelStatusResponse

type OvmsModelManager

type OvmsModelManager struct {
	// contains filtered or unexported fields
}

The OVMS Model Manager follows the Actor pattern to own and manage models

The exposed functions are thread safe; they send messages to the Actor and wait for a response. The Manager runs a background event loop to process model updates in batches

func NewOvmsModelManager

func NewOvmsModelManager(address string, multiModelConfigFilename string, log logr.Logger, mmConfig ModelManagerConfig) (*OvmsModelManager, error)

func (*OvmsModelManager) GetConfig

func (mm *OvmsModelManager) GetConfig(ctx context.Context) error

func (*OvmsModelManager) LoadModel

func (mm *OvmsModelManager) LoadModel(ctx context.Context, modelPath string, modelId string) error

"Client" API

func (*OvmsModelManager) UnloadAll

func (mm *OvmsModelManager) UnloadAll(ctx context.Context) error

func (*OvmsModelManager) UnloadModel

func (mm *OvmsModelManager) UnloadModel(ctx context.Context, modelId string) error

type OvmsModelStatus

type OvmsModelStatus struct {
	ErrorCode    string `json:"error_code"`
	ErrorMessage string `json:"error_message"`
}

type OvmsModelStatusResponse

type OvmsModelStatusResponse struct {
	ModelVersionStatus []OvmsModelVersionStatus `json:"model_version_status"`
}

type OvmsModelVersionStatus

type OvmsModelVersionStatus struct {
	Version string          `json:"version"`
	State   string          `json:"state"`
	Status  OvmsModelStatus `json:"status"`
}

type OvmsMultiModelConfigListEntry

type OvmsMultiModelConfigListEntry struct {
	Config OvmsMultiModelModelConfig `json:"config"`
}

type OvmsMultiModelModelConfig

type OvmsMultiModelModelConfig struct {
	Name     string `json:"name"`
	BasePath string `json:"base_path"`
}

type OvmsMultiModelRepositoryConfig

type OvmsMultiModelRepositoryConfig struct {
	ModelConfigList []OvmsMultiModelConfigListEntry `json:"model_config_list"`
}

Types defining the structure of the OVMS Multi-Model config file

Doc: https://github.com/openvinotoolkit/model_server/blob/main/docs/multiple_models_mode.md JSON Schema: https://github.com/openvinotoolkit/model_server/blob/eab97207fbe9078f83a3f85b468418555b02959a/src/schema.cpp#L28

EXAMPLE:

{
  "model_config_list": [
    {
      "config": {
        "name": "model_name1",
        "base_path": "/models/model1"
      }
    },
    {
      "config": {
        "name": "model_name2",
        "base_path": "/models/model1"
      }
    }
  ]
}

Jump to

Keyboard shortcuts

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