Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logs for loading/unloading model #5

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions model-mesh-triton-adapter/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ func (s *TritonAdapterServer) LoadModel(ctx context.Context, req *mmesh.LoadMode
return nil, status.Errorf(status.Code(err), "Failed to load Model due to adapter error: %s", err)
}

s.Log.Info("Trying to load model", "model_id", req.ModelId)
loadStart := time.Now()

_, tritonErr := s.Client.RepositoryModelLoad(ctx, &triton.RepositoryModelLoadRequest{
ModelName: req.ModelId,
})

s.Log.Info("Loaded model request done", "model_id", req.ModelId, "duration", time.Since(loadStart))

if tritonErr != nil {
log.Error(tritonErr, "Triton failed to load model")
return nil, status.Errorf(status.Code(tritonErr), "Failed to load Model due to Triton runtime error: %s", tritonErr)
Expand Down Expand Up @@ -158,9 +164,12 @@ func getModelType(req *mmesh.LoadModelRequest, log logr.Logger) string {
}

func (s *TritonAdapterServer) UnloadModel(ctx context.Context, req *mmesh.UnloadModelRequest) (*mmesh.UnloadModelResponse, error) {
s.Log.Info("Trying to unload model", "model_id", req.ModelId)
unloadStart := time.Now()
_, tritonErr := s.Client.RepositoryModelUnload(ctx, &triton.RepositoryModelUnloadRequest{
ModelName: req.ModelId,
})
s.Log.Info("Unloaded model request done", "model_id", req.ModelId, "duration", time.Since(unloadStart))

if tritonErr != nil {
// check if we got a gRPC error as a response that indicates that Triton
Expand Down