Skip to content

Commit

Permalink
Merge pull request #55 from tbs60/dev_michealhe
Browse files Browse the repository at this point in the history
server 日志优化 #54
  • Loading branch information
tming authored Jul 28, 2023
2 parents 10e9080 + 5de51a9 commit 69d87d5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/backend/booster/server/pkg/manager/normal/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (k *keeper) checkTaskBasic(taskID string, wg *sync.WaitGroup) {
}

// 拉起资源超时,此时若有足够的资源,则先启动任务
blog.Errorf("keeper: check and find task(%s) starting timeout(%s) since(%s), check if it can be running",
blog.Infof("keeper: check and find task(%s) starting timeout(%s) since(%s), check if it can be running",
tb.ID, k.conf.KeepStartingTimeout.String(), tb.Status.LaunchTime.String())
if task.EnoughAvailableResource() {
tb.Status.Ready()
Expand Down
4 changes: 2 additions & 2 deletions src/backend/booster/server/pkg/manager/normal/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ func (s *selector) pick(egn engine.Engine, tqg *engine.TaskQueueGroup, queueName

if err = egn.LaunchTask(tb, queueName); err != nil {
if err != engine.ErrorNoEnoughResources {
blog.Errorf("selector: launch task(%s) from engine(%s) queue(%s) failed: %v", tb.ID, egn.Name(), queueName, err)
blog.Infof("selector: launch task(%s) from engine(%s) queue(%s) failed: %v", tb.ID, egn.Name(), queueName, err)
}
blog.Errorf("selector: launch task(%s) from engine(%s) queue(%s) failed: %v", tb.ID, egn.Name(), queueName, err)
blog.Infof("selector: launch task(%s) from engine(%s) queue(%s) failed: %v", tb.ID, egn.Name(), queueName, err)
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/booster/server/pkg/manager/normal/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (t *tracker) isFinishStarting(taskID string, egn engine.Engine) bool {

ok, err := egn.LaunchDone(taskID)
if err != nil {
blog.Errorf("tracker: check task(%s) launch done failed: %v", taskID, err)
blog.Infof("tracker: check task(%s) launch done failed: %v", taskID, err)
return false
}

Expand Down
8 changes: 5 additions & 3 deletions src/backend/booster/server/pkg/resource/crm/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ func (b *Broker) launch() error {
if availableInstance >= b.param.Instance {
return b.param.Instance, nil
}

blog.Errorf("crm broker: failed to launch resource(%s) for broker(%s) with user(%s), need (%d) instances"+
", only (%d) available", brokerID, b.name, b.user, b.param.Instance, availableInstance)
return 0, ErrorBrokerNotEnoughResources
}, false)
if err == ErrorBrokerNotEnoughResources {
Expand Down Expand Up @@ -472,8 +473,9 @@ func (b *Broker) track(resourceID string, startTime time.Time) bool {
}

if !instanceok {
blog.Errorf("crm broker: track resource(%s) from broker(%s) with user(%s), not found expected %d instances, release it",
resourceID, b.name, b.user, b.param.Instance)
blog.Errorf("crm broker: track resource(%s) from broker(%s) with user(%s), not found "+
"expected %d instances after %f seconds, release it",
resourceID, b.name, b.user, b.param.Instance, time.Since(startTime).Seconds())
// release this resource
err = b.mgr.release(resource.resourceID, b.user)
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion src/backend/booster/server/pkg/resource/crm/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,15 @@ func (rm *resourceManager) checkBroker(broker *Broker) {
for i := 0; i < delta; i++ {
if err := broker.Launch(); err != nil {
switch err {
case ErrorBrokerNotEnoughResources, ErrorBrokeringUnderCoolingTime:
case ErrorBrokerNotEnoughResources:
blog.Errorf("crm: try launching resource for broker(%s) with user(%s) failed: %v",
broker.name, broker.user, err)
return
case ErrorBrokeringUnderCoolingTime:
blog.Warnf("crm: try launching resource for broker(%s) with user(%s) failed: %v",
broker.name, broker.user, err)

return
}
blog.Errorf("crm: try launching resource for broker(%s) with user(%s) failed: %v",
broker.name, broker.user, err)
Expand Down

0 comments on commit 69d87d5

Please sign in to comment.