Documentation ¶
Index ¶
- Variables
- func CancelTask(ctx context.Context, taskKey string) error
- func GetCPUCountOfNode(ctx context.Context) (int, error)
- func NotifyTaskChange()
- func PauseTask(ctx context.Context, taskKey string) error
- func ResumeTask(ctx context.Context, taskKey string) error
- func RunWithRetry(ctx context.Context, maxRetry int, backoffer backoff.Backoffer, ...) error
- func SubmitTask(ctx context.Context, taskKey string, taskType proto.TaskType, concurrency int, ...) (*proto.Task, error)
- func WaitTask(ctx context.Context, id int64, matchFn func(base *proto.TaskBase) bool) (*proto.TaskBase, error)
- func WaitTaskDoneByKey(ctx context.Context, taskKey string) error
- func WaitTaskDoneOrPaused(ctx context.Context, id int64) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TaskChangedCh used to speed up task schedule, such as when task is submitted // in the same node as the scheduler manager. // put it here to avoid cyclic import. TaskChangedCh = make(chan struct{}, 1) )
Functions ¶
func CancelTask ¶
CancelTask cancels a task.
func GetCPUCountOfNode ¶
GetCPUCountOfNode gets the CPU count of the managed node.
func NotifyTaskChange ¶
func NotifyTaskChange()
NotifyTaskChange is used to notify the scheduler manager that the task is changed, either a new task is submitted or a task is finished.
func ResumeTask ¶
ResumeTask resumes a task.
func RunWithRetry ¶
func RunWithRetry( ctx context.Context, maxRetry int, backoffer backoff.Backoffer, logger *zap.Logger, f func(context.Context) (bool, error), ) error
RunWithRetry runs a function with retry, when retry exceed max retry time, it returns the last error met. if the function fails with err, it should return a bool to indicate whether the error is retryable. if context done, it will stop early and return ctx.Err().
func SubmitTask ¶
func SubmitTask(ctx context.Context, taskKey string, taskType proto.TaskType, concurrency int, targetScope string, taskMeta []byte) (*proto.Task, error)
SubmitTask submits a task.
func WaitTask ¶
func WaitTask(ctx context.Context, id int64, matchFn func(base *proto.TaskBase) bool) (*proto.TaskBase, error)
WaitTask waits for a task until it meets the matchFn.
func WaitTaskDoneByKey ¶
WaitTaskDoneByKey waits for a task done by task key.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.