Skip to content

Commit

Permalink
feat(worker,hatchery): model requirement check enforce group name (#6209
Browse files Browse the repository at this point in the history
)
  • Loading branch information
richardlt committed Jun 13, 2022
1 parent 8d041a0 commit cb49dff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions engine/worker/internal/requirement.go
Expand Up @@ -121,8 +121,8 @@ func checkModelRequirement(w *CurrentWorker, r sdk.Requirement) (bool, error) {
}

isSharedInfra := w.model.Group.Name == sdk.SharedInfraGroupName && modelName == w.model.Name
isSameName := modelName == w.model.Name // for backward compatibility with runs, if only the name match we considered that the model can be used, keep this condition until the workflow runs were not migrated.
return isSharedInfra || isSameName, nil

return isSharedInfra, nil
}

func checkServiceRequirement(w *CurrentWorker, r sdk.Requirement) (bool, error) {
Expand Down
3 changes: 1 addition & 2 deletions sdk/hatchery/hatchery.go
Expand Up @@ -423,8 +423,7 @@ func canRunJobWithModel(ctx context.Context, h InterfaceWithModels, j workerStar
modelName := strings.Split(r.Value, " ")[0]
isGroupModel := modelName == fmt.Sprintf("%s/%s", model.Group.Name, model.Name)
isSharedInfraModel := model.Group.Name == sdk.SharedInfraGroupName && modelName == model.Name
isSameName := modelName == model.Name // for backward compatibility with runs, if only the name match we considered that the model can be used, keep this condition until the workflow runs were not migrated.
if !isGroupModel && !isSharedInfraModel && !isSameName {
if !isGroupModel && !isSharedInfraModel {
log.Debug(ctx, "canRunJobWithModel> %d - job %d - model requirement r.Value(%s) do not match model.Name(%s) and model.Group(%s)", j.timestamp, j.id, strings.Split(r.Value, " ")[0], model.Name, model.Group.Name)
next()
return false
Expand Down

0 comments on commit cb49dff

Please sign in to comment.