(parentLog log.Logger, taskId uint64)
| 97 | } |
| 98 | |
| 99 | func runTaskStandalone(parentLog log.Logger, taskId uint64) errors.Error { |
| 100 | // deferring cleaning up |
| 101 | defer func() { |
| 102 | _, _ = runningTasks.Remove(taskId) |
| 103 | }() |
| 104 | // for task cancelling |
| 105 | ctx, cancel := context.WithCancel(context.Background()) |
| 106 | err := runningTasks.Add(taskId, cancel) |
| 107 | if err != nil { |
| 108 | return err |
| 109 | } |
| 110 | // now , create a progress update channel and kick off |
| 111 | progress := make(chan plugin.RunningProgress, 100) |
| 112 | doneSignal := make(chan struct{}) |
| 113 | go updateTaskProgress(doneSignal, taskId, progress) |
| 114 | err = runner.RunTask( |
| 115 | ctx, |
| 116 | basicRes.ReplaceLogger(parentLog), |
| 117 | progress, |
| 118 | taskId, |
| 119 | ) |
| 120 | close(progress) |
| 121 | // wait all progresses are handled |
| 122 | <-doneSignal |
| 123 | return err |
| 124 | } |
| 125 | |
| 126 | func getRunningTaskById(taskId uint64) *RunningTaskData { |
| 127 | runningTasks.mu.Lock() |
no test coverage detected