Skip to content

Commit

Permalink
chore(model): update predeploy model logic (#437)
Browse files Browse the repository at this point in the history
Because

- bypass predeploy model list

This commit

- bypass predeploy model list
  • Loading branch information
heiruwu authored Oct 22, 2023
1 parent b5d47a0 commit 115fa60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions cmd/model/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/instill-ai/model-backend/pkg/utils"

custom_otel "github.com/instill-ai/model-backend/pkg/logger/otel"
mgmtPB "github.com/instill-ai/protogen-go/core/mgmt/v1alpha"
commonPB "github.com/instill-ai/protogen-go/common/task/v1alpha"
mgmtPB "github.com/instill-ai/protogen-go/core/mgmt/v1alpha"
modelPB "github.com/instill-ai/protogen-go/model/model/v1alpha"
)

Expand Down Expand Up @@ -137,7 +137,9 @@ func main() {
}

var userID string
if !strings.HasPrefix(config.Config.Server.Edition, "cloud") || strings.HasSuffix(config.Config.Server.Edition, "test"){
if !strings.HasPrefix(config.Config.Server.Edition, "cloud") ||
strings.HasSuffix(config.Config.Server.Edition, "test") ||
strings.HasSuffix(config.Config.Server.Edition, "dev") {
userID = fmt.Sprintf("users/%s", constant.DefaultUserID)
} else {
userID = fmt.Sprintf("users/%s", constant.InstillUserID)
Expand Down
8 changes: 4 additions & 4 deletions pkg/worker/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func GetPreDeployGitHubModelUUID(model *datamodel.Model) (*datamodel.PreDeployMo
return nil, nil
}

if _, found := preDeployModelMap[model.ID]; !found {
return nil, nil
}

var preDeployModelConfigs []PreModelConfig
err := utils.GetJSON(config.Config.InitModel.Path, &preDeployModelConfigs)
if err != nil {
Expand All @@ -89,10 +93,6 @@ func GetPreDeployGitHubModelUUID(model *datamodel.Model) (*datamodel.PreDeployMo

var githubModel *datamodel.PreDeployModel

if _, found := preDeployModelMap[model.ID]; !found {
return githubModel, nil
}

for _, preDeployModelConfigs := range preDeployModelConfigs {
if modelConfig.Repository == preDeployModelConfigs.Configuration["repository"] &&
modelConfig.Tag == preDeployModelConfigs.Configuration["tag"] {
Expand Down

0 comments on commit 115fa60

Please sign in to comment.