Skip to content

Commit 03274c4

Browse files
committed
feat(runner): include processed record count in subtask finish logs
1 parent 3538c53 commit 03274c4

4 files changed

Lines changed: 13 additions & 1 deletion

File tree

backend/core/plugin/plugin_task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type ExecContext interface {
5353
GetData() interface{}
5454
SetProgress(current int, total int)
5555
IncProgress(quantity int)
56+
GetProgress() int
5657
}
5758

5859
// SubTaskContext This interface define all resources that needed for subtask execution

backend/core/runner/run_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func RunPluginSubTasks(
336336
logger.Info("executing subtask %s", subtaskMeta.Name)
337337
start := time.Now()
338338
err = runSubtask(basicRes, subtaskCtx, task.ID, subtaskNumber, subtaskMeta.EntryPoint)
339-
logger.Info("subtask %s finished in %d ms", subtaskMeta.Name, time.Since(start).Milliseconds())
339+
logger.Info("subtask %s finished in %d ms, records processed: %d", subtaskMeta.Name, time.Since(start).Milliseconds(), subtaskCtx.GetProgress())
340340
if err != nil {
341341
err = errors.SubtaskErr.Wrap(err, fmt.Sprintf("subtask %s ended unexpectedly", subtaskMeta.Name), errors.WithData(&subtaskMeta))
342342
logger.Error(err, "")

backend/impls/context/default_exec_context.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ func (c *defaultExecContext) IncProgress(progressType plugin.ProgressType, quant
9696
}
9797
}
9898

99+
func (c *defaultExecContext) GetProgress() int {
100+
return int(atomic.LoadInt64(&c.current))
101+
}
102+
99103
func (c *defaultExecContext) fork(name string) *defaultExecContext {
100104
return newDefaultExecContext(
101105
c.ctx,

backend/server/services/remote/bridge/context.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,11 @@ func (r remoteContextImpl) IncProgress(quantity int) {
138138
}
139139
}
140140

141+
func (r remoteContextImpl) GetProgress() int {
142+
if r.parent != nil {
143+
return r.parent.GetProgress()
144+
}
145+
return 0
146+
}
147+
141148
var _ RemoteContext = (*remoteContextImpl)(nil)

0 commit comments

Comments
 (0)