2023-08-15 15:58:07 +08:00
|
|
|
|
package task
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"gitlink.org.cn/cloudream/common/pkgs/task"
|
2023-09-04 09:51:20 +08:00
|
|
|
|
reporter "gitlink.org.cn/cloudream/scheduler/executor/internal/reporter"
|
2023-08-15 15:58:07 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type TaskContext struct {
|
2023-09-04 09:51:20 +08:00
|
|
|
|
reporter *reporter.Reporter
|
2023-08-15 15:58:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 需要在Task结束后主动调用,completing函数将在Manager加锁期间被调用,
|
|
|
|
|
|
// 因此适合进行执行结果的设置
|
|
|
|
|
|
type CompleteFn = task.CompleteFn
|
|
|
|
|
|
|
|
|
|
|
|
type Manager = task.Manager[TaskContext]
|
|
|
|
|
|
|
|
|
|
|
|
type TaskBody = task.TaskBody[TaskContext]
|
|
|
|
|
|
|
|
|
|
|
|
type Task = task.Task[TaskContext]
|
|
|
|
|
|
|
|
|
|
|
|
type CompleteOption = task.CompleteOption
|
|
|
|
|
|
|
2023-09-04 09:51:20 +08:00
|
|
|
|
func NewManager(reporter *reporter.Reporter) Manager {
|
|
|
|
|
|
return task.NewManager(TaskContext{
|
|
|
|
|
|
reporter: reporter,
|
|
|
|
|
|
})
|
2023-08-15 15:58:07 +08:00
|
|
|
|
}
|