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

fix(hatchery): log level for hatchery book model #6190

Merged
merged 3 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions engine/api/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ func ResetEventIntegration(ctx context.Context, db gorp.SqlExecutor, eventIntegr
kafkaCfg := getKafkaConfig(projInt.Config)
kafkaBroker, err := getBroker(ctx, "kafka", kafkaCfg)
if err != nil {
return sdk.WrapError(sdk.ErrBadBrokerConfiguration, "cannot get broker for %s and user %s : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
return sdk.WrapError(sdk.ErrBadBrokerConfiguration, "cannot get broker for %q and user %q : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
}
if err := brokersConnectionCache.Add(brokerConnectionKey, kafkaBroker, gocache.DefaultExpiration); err != nil {
return sdk.WrapError(sdk.ErrBadBrokerConfiguration, "cannot add broker in cache for %s and user %s : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
return sdk.WrapError(sdk.ErrBadBrokerConfiguration, "cannot add broker in cache for %q and user %q : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
}
return nil
}
Expand Down Expand Up @@ -213,11 +213,11 @@ func DequeueEvent(ctx context.Context, db *gorp.DbMap) {
kafkaCfg := getKafkaConfig(projInt.Config)
kafkaBroker, err := getBroker(ctx, "kafka", kafkaCfg)
if err != nil {
log.Error(ctx, "Event.DequeueEvent> cannot get broker for %s and user %s : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
log.Error(ctx, "Event.DequeueEvent> cannot get broker for %q and user %q : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
continue
}
if err := brokersConnectionCache.Add(brokerConnectionKey, kafkaBroker, gocache.DefaultExpiration); err != nil {
log.Error(ctx, "Event.DequeueEvent> cannot add broker in cache for %s and user %s : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
log.Error(ctx, "Event.DequeueEvent> cannot add broker in cache for %q and user %q : %v", projInt.Config["broker url"].Value, projInt.Config["username"].Value, err)
continue
}
brokerConnection = kafkaBroker
Expand Down
6 changes: 5 additions & 1 deletion sdk/hatchery/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ loopModels:

if err := h.CDSClient().WorkerModelBook(models[k].Group.Name, models[k].Name); err != nil {
ctx := log.ContextWithStackTrace(ctx, err)
log.Error(ctx, "cannot book model %s with id %d: %v", models[k].Path(), models[k].ID, err)
if sdk.ErrorIs(err, sdk.ErrWorkerModelAlreadyBooked) {
log.Info(ctx, "worker model already booked. model %s with id %d: %v", models[k].Path(), models[k].ID, err)
} else {
log.Error(ctx, "cannot book model %s with id %d: %v", models[k].Path(), models[k].ID, err)
}
continue
}

Expand Down