Skip to content

Commit cb49dff

Browse files
authored
feat(worker,hatchery): model requirement check enforce group name (#6209)
1 parent 8d041a0 commit cb49dff

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

engine/worker/internal/requirement.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ func checkModelRequirement(w *CurrentWorker, r sdk.Requirement) (bool, error) {
121121
}
122122

123123
isSharedInfra := w.model.Group.Name == sdk.SharedInfraGroupName && modelName == w.model.Name
124-
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.
125-
return isSharedInfra || isSameName, nil
124+
125+
return isSharedInfra, nil
126126
}
127127

128128
func checkServiceRequirement(w *CurrentWorker, r sdk.Requirement) (bool, error) {

sdk/hatchery/hatchery.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ func canRunJobWithModel(ctx context.Context, h InterfaceWithModels, j workerStar
423423
modelName := strings.Split(r.Value, " ")[0]
424424
isGroupModel := modelName == fmt.Sprintf("%s/%s", model.Group.Name, model.Name)
425425
isSharedInfraModel := model.Group.Name == sdk.SharedInfraGroupName && modelName == model.Name
426-
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.
427-
if !isGroupModel && !isSharedInfraModel && !isSameName {
426+
if !isGroupModel && !isSharedInfraModel {
428427
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)
429428
next()
430429
return false

0 commit comments

Comments
 (0)