Admin UI: Fetch task logs (#7114)
* show task details * loading tasks * task UI works * generic rendering * rendering the export link * removing placementConflicts from task parameters * remove TaskSourceLocation * remove "Server ID" column * rendering balance task source * sources and targets * fix ec task generation * move info * render timeline * simplified worker id * simplify * read task logs from worker * isValidTaskID * address comments * Update weed/worker/tasks/balance/execution.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/worker/tasks/erasure_coding/ec_task.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update weed/worker/tasks/task_log_handler.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix shard ids * plan distributing shard id * rendering planned shards in task details * remove Conflicts * worker logs correctly * pass in dc and rack * task logging * Update weed/admin/maintenance/maintenance_queue.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * display log details * logs have fields now * sort field keys * fix link * fix collection filtering * avoid hard coded ec shard counts --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -16,7 +16,8 @@ type BaseTypedTask struct {
|
||||
taskType types.TaskType
|
||||
taskID string
|
||||
progress float64
|
||||
progressCallback func(float64)
|
||||
progressCallback func(float64, string)
|
||||
currentStage string
|
||||
cancelled bool
|
||||
mutex sync.RWMutex
|
||||
|
||||
@@ -75,21 +76,49 @@ func (bt *BaseTypedTask) GetProgress() float64 {
|
||||
func (bt *BaseTypedTask) SetProgress(progress float64) {
|
||||
bt.mutex.Lock()
|
||||
callback := bt.progressCallback
|
||||
stage := bt.currentStage
|
||||
bt.progress = progress
|
||||
bt.mutex.Unlock()
|
||||
|
||||
if callback != nil {
|
||||
callback(progress)
|
||||
callback(progress, stage)
|
||||
}
|
||||
}
|
||||
|
||||
// SetProgressCallback sets the progress callback function
|
||||
func (bt *BaseTypedTask) SetProgressCallback(callback func(float64)) {
|
||||
func (bt *BaseTypedTask) SetProgressCallback(callback func(float64, string)) {
|
||||
bt.mutex.Lock()
|
||||
defer bt.mutex.Unlock()
|
||||
bt.progressCallback = callback
|
||||
}
|
||||
|
||||
// SetProgressWithStage sets the current progress with a stage description
|
||||
func (bt *BaseTypedTask) SetProgressWithStage(progress float64, stage string) {
|
||||
bt.mutex.Lock()
|
||||
callback := bt.progressCallback
|
||||
bt.progress = progress
|
||||
bt.currentStage = stage
|
||||
bt.mutex.Unlock()
|
||||
|
||||
if callback != nil {
|
||||
callback(progress, stage)
|
||||
}
|
||||
}
|
||||
|
||||
// SetCurrentStage sets the current stage description
|
||||
func (bt *BaseTypedTask) SetCurrentStage(stage string) {
|
||||
bt.mutex.Lock()
|
||||
defer bt.mutex.Unlock()
|
||||
bt.currentStage = stage
|
||||
}
|
||||
|
||||
// GetCurrentStage returns the current stage description
|
||||
func (bt *BaseTypedTask) GetCurrentStage() string {
|
||||
bt.mutex.RLock()
|
||||
defer bt.mutex.RUnlock()
|
||||
return bt.currentStage
|
||||
}
|
||||
|
||||
// SetLoggerConfig sets the logger configuration for this task
|
||||
func (bt *BaseTypedTask) SetLoggerConfig(config types.TaskLoggerConfig) {
|
||||
bt.mutex.Lock()
|
||||
@@ -200,8 +229,8 @@ func (bt *BaseTypedTask) ValidateTyped(params *worker_pb.TaskParams) error {
|
||||
if params.VolumeId == 0 {
|
||||
return errors.New("volume_id is required")
|
||||
}
|
||||
if params.Server == "" {
|
||||
return errors.New("server is required")
|
||||
if len(params.Sources) == 0 {
|
||||
return errors.New("at least one source is required")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user