diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-27 11:04:51 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-27 11:04:51 -0700 |
| commit | 1b64a0f0344c4c1066833a6d25b20dca9bb171e5 (patch) | |
| tree | 9b8d8600b7b9d8fc43127cb2878b3dc625a60427 /weed/worker/tasks/balance/balance.go | |
| parent | 9025b722410c605181b094fbeeed66de002fda27 (diff) | |
| download | seaweedfs-origin/worker-execute-ec-tasks.tar.xz seaweedfs-origin/worker-execute-ec-tasks.zip | |
add generic logging and implement it for balancing taskorigin/worker-execute-ec-tasks
Diffstat (limited to 'weed/worker/tasks/balance/balance.go')
| -rw-r--r-- | weed/worker/tasks/balance/balance.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/worker/tasks/balance/balance.go b/weed/worker/tasks/balance/balance.go index ea867d950..657c32df4 100644 --- a/weed/worker/tasks/balance/balance.go +++ b/weed/worker/tasks/balance/balance.go @@ -30,6 +30,7 @@ func NewTask(server string, volumeID uint32, collection string) *Task { // Execute executes the balance task func (t *Task) Execute(params types.TaskParams) error { + t.LogInfo("Starting balance task for volume %d on server %s (collection: %s)", t.volumeID, t.server, t.collection) glog.Infof("Starting balance task for volume %d on server %s (collection: %s)", t.volumeID, t.server, t.collection) // Simulate balance operation with progress updates @@ -45,18 +46,23 @@ func (t *Task) Execute(params types.TaskParams) error { {"Verifying balance", 1 * time.Second, 100}, } - for _, step := range steps { + for i, step := range steps { if t.IsCancelled() { + t.LogWarning("Balance task cancelled at step %d: %s", i+1, step.name) return fmt.Errorf("balance task cancelled") } + t.LogInfo("Starting step %d/%d: %s", i+1, len(steps), step.name) glog.V(1).Infof("Balance task step: %s", step.name) t.SetProgress(step.progress) // Simulate work time.Sleep(step.duration) + + t.LogDebug("Completed step %d/%d: %s (progress: %.1f%%)", i+1, len(steps), step.name, step.progress) } + t.LogInfo("Balance task completed successfully for volume %d on server %s", t.volumeID, t.server) glog.Infof("Balance task completed for volume %d on server %s", t.volumeID, t.server) return nil } |
