MCPcopy Index your code
hub / github.com/apache/devlake / runTaskStandalone

Function runTaskStandalone

backend/server/services/task_runner.go:99–124  ·  view source on GitHub ↗
(parentLog log.Logger, taskId uint64)

Source from the content-addressed store, hash-verified

97}
98
99func 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
126func getRunningTaskById(taskId uint64) *RunningTaskData {
127 runningTasks.mu.Lock()

Callers 1

RunTasksStandaloneFunction · 0.85

Calls 4

updateTaskProgressFunction · 0.85
RemoveMethod · 0.80
ReplaceLoggerMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected