server

package
v1.25.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type S

type S struct {
	v1.UnimplementedModelsServiceServer
	// contains filtered or unexported fields
}

S is a server.

func New

func New(store *store.S, pcache pcache, log logr.Logger) *S

New creates a server.

func (*S) ActivateModel added in v1.17.0

func (s *S) ActivateModel(ctx context.Context, req *v1.ActivateModelRequest) (*v1.ActivateModelResponse, error)

ActivateModel activates a model.

func (*S) CreateModel added in v1.10.0

func (s *S) CreateModel(
	ctx context.Context,
	req *v1.CreateModelRequest,
) (*v1.Model, error)

CreateModel creates a base model.

func (*S) DeactivateModel added in v1.17.0

func (s *S) DeactivateModel(ctx context.Context, req *v1.DeactivateModelRequest) (*v1.DeactivateModelResponse, error)

DeactivateModel deactivates a model.

func (*S) DeleteModel

func (s *S) DeleteModel(
	ctx context.Context,
	req *v1.DeleteModelRequest,
) (*v1.DeleteModelResponse, error)

DeleteModel deletes a model.

func (*S) GetModel

func (s *S) GetModel(
	ctx context.Context,
	req *v1.GetModelRequest,
) (*v1.Model, error)

GetModel gets a model.

func (*S) GracefulStop added in v1.16.0

func (s *S) GracefulStop()

GracefulStop gracefully stops the gRPC server.

func (*S) ListModels

func (s *S) ListModels(
	ctx context.Context,
	req *v1.ListModelsRequest,
) (*v1.ListModelsResponse, error)

ListModels lists models.

func (*S) Run

func (s *S) Run(ctx context.Context, port int, authConfig config.AuthConfig, usage sender.UsageSetter) error

Run starts the gRPC server.

func (*S) Stop

func (s *S) Stop()

Stop stops the gRPC server.

func (*S) UpdateModel added in v1.24.0

func (s *S) UpdateModel(
	ctx context.Context,
	req *v1.UpdateModelRequest,
) (*v1.Model, error)

UpdateModel updates a model.

type WS

type WS struct {
	v1.UnimplementedModelsWorkerServiceServer
	// contains filtered or unexported fields
}

WS is a server for worker services.

func NewWorkerServiceServer

func NewWorkerServiceServer(s *store.S, pcache pcache, log logr.Logger) *WS

NewWorkerServiceServer creates a new worker service server.

func (*WS) AcquireUnloadedBaseModel added in v1.10.0

func (s *WS) AcquireUnloadedBaseModel(
	ctx context.Context,
	req *v1.AcquireUnloadedBaseModelRequest,
) (*v1.AcquireUnloadedBaseModelResponse, error)

AcquireUnloadedBaseModel checks if there is any unloaded base model. If exists, update the loading status to LOADED and return it.

TODO(kenji): Exclude models that shouldn't be loaded in the requesting cluster based on their model config.

func (*WS) AcquireUnloadedModel added in v1.14.0

func (s *WS) AcquireUnloadedModel(
	ctx context.Context,
	req *v1.AcquireUnloadedModelRequest,
) (*v1.AcquireUnloadedModelResponse, error)

AcquireUnloadedModel checks if there is any unloaded model. If exists, update the loading status to LOADED and return it.

TODO(kenji): Exclude models that shouldn't be loaded in the requesting cluster based on their model config.

func (*WS) CreateBaseModel

func (s *WS) CreateBaseModel(
	ctx context.Context,
	req *v1.CreateBaseModelRequest,
) (*v1.BaseModel, error)

CreateBaseModel creates a base model.

func (*WS) CreateHFModelRepo added in v1.4.0

func (s *WS) CreateHFModelRepo(
	ctx context.Context,
	req *v1.CreateHFModelRepoRequest,
) (*v1.HFModelRepo, error)

CreateHFModelRepo creates a HuggingFace model repo.

func (*WS) CreateStorageConfig

func (s *WS) CreateStorageConfig(
	ctx context.Context,
	req *v1.CreateStorageConfigRequest,
) (*v1.StorageConfig, error)

CreateStorageConfig creates a storage config.

func (*WS) GetBaseModelPath

func (s *WS) GetBaseModelPath(
	ctx context.Context,
	req *v1.GetBaseModelPathRequest,
) (*v1.GetBaseModelPathResponse, error)

GetBaseModelPath gets a model path.

func (*WS) GetHFModelRepo added in v1.4.0

func (s *WS) GetHFModelRepo(
	ctx context.Context,
	req *v1.GetHFModelRepoRequest,
) (*v1.HFModelRepo, error)

GetHFModelRepo gets a HuggingFace model repo.

func (*WS) GetModel

func (s *WS) GetModel(ctx context.Context, req *v1.GetModelRequest) (*v1.Model, error)

GetModel gets a model.

func (*WS) GetModelAttributes

func (s *WS) GetModelAttributes(
	ctx context.Context,
	req *v1.GetModelAttributesRequest,
) (*v1.ModelAttributes, error)

GetModelAttributes gets the model attributes.

func (*WS) GetModelPath

func (s *WS) GetModelPath(
	ctx context.Context,
	req *v1.GetModelPathRequest,
) (*v1.GetModelPathResponse, error)

GetModelPath gets a model path.

func (*WS) GetStorageConfig

func (s *WS) GetStorageConfig(
	ctx context.Context,
	req *v1.GetStorageConfigRequest,
) (*v1.StorageConfig, error)

GetStorageConfig gets a storage config.

func (*WS) GracefulStop added in v1.16.0

func (ws *WS) GracefulStop()

GracefulStop gracefully stops the worker service server.

func (*WS) ListModels added in v1.18.0

func (s *WS) ListModels(ctx context.Context, req *v1.ListModelsRequest) (*v1.ListModelsResponse, error)

ListModels lists models.

TODO(kenji): Exclude models that shouldn't be loaded in the requesting cluster based on their model config.

func (*WS) PublishModel

func (s *WS) PublishModel(
	ctx context.Context,
	req *v1.PublishModelRequest,
) (*v1.PublishModelResponse, error)

PublishModel publishes a fine-tuned model.

func (*WS) RegisterModel

func (s *WS) RegisterModel(
	ctx context.Context,
	req *v1.RegisterModelRequest,
) (*v1.RegisterModelResponse, error)

RegisterModel registers a fine-tuned model. The model is created in the database, but not published yet.

func (*WS) Run

func (ws *WS) Run(ctx context.Context, port int, authConfig config.AuthConfig) error

Run runs the worker service server.

func (*WS) Stop

func (ws *WS) Stop()

Stop stops the worker service server.

func (*WS) UpdateBaseModelLoadingStatus added in v1.10.0

func (s *WS) UpdateBaseModelLoadingStatus(
	ctx context.Context,
	req *v1.UpdateBaseModelLoadingStatusRequest,
) (*v1.UpdateBaseModelLoadingStatusResponse, error)

UpdateBaseModelLoadingStatus updates the loading status. When the loading succeeded, it also updates the base model metadata.

func (*WS) UpdateModelLoadingStatus added in v1.14.0

func (s *WS) UpdateModelLoadingStatus(
	ctx context.Context,
	req *v1.UpdateModelLoadingStatusRequest,
) (*v1.UpdateModelLoadingStatusResponse, error)

UpdateModelLoadingStatus updates the loading status. When the loading succeeded, it also updates the model metadata.

Jump to

Keyboard shortcuts

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