MCPcopy Create free account
hub / github.com/actiontech/dtle / GetTaskStatistics

Method GetTaskStatistics

driver/state.go:62–85  ·  view source on GitHub ↗

it can only use allocId and taskName to identify the task from http api

(allocId, taskName string)

Source from the content-addressed store, hash-verified

60
61// it can only use allocId and taskName to identify the task from http api
62func (ts *TaskStoreForApi) GetTaskStatistics(allocId, taskName string) (*common.TaskStatistics, bool, error) {
63 ts.lock.RLock()
64 defer ts.lock.RUnlock()
65
66 prefix := fmt.Sprintf("%v-%v-", allocId, taskName)
67 for k, _ := range ts.store {
68 if strings.HasPrefix(k, prefix) {
69 t, ok := ts.store[k]
70
71 var stats *common.TaskStatistics
72 if t.runner != nil {
73 var err error
74 stats, err = t.runner.Stats()
75 if nil != err {
76 return nil, false, fmt.Errorf("get stats from taskHandle failed: %v", err)
77 }
78 } else {
79 stats = &common.TaskStatistics{}
80 }
81 return stats, ok, nil
82 }
83 }
84 return nil, false, nil
85}
86
87func (ts *TaskStoreForApi) Delete(id string) {
88 ts.lock.Lock()

Callers

nothing calls this directly

Calls 1

StatsMethod · 0.65

Tested by

no test coverage detected