Documentation ¶
Overview ¶
Package taskexecutor defines a "production-ready" task executor.
For local/non-production use, consider looking at cmd/localjobs's task executor
Index ¶
- func CreateTask(ctx context.Context, pool *pgxpool.Pool, task taskdef.TaskDefinition) (*string, error)
- func ExecuteTask(ctx context.Context, ctxCancel context.CancelFunc, taskId string, ...)
- func GetPersistedTaskState(tc *TaskProgress) (*taskstate.Progress, error)
- func PersistTaskState(tc *TaskProgress, prog *taskstate.Progress) error
- type MutLogger
- type TaskProgress
- type TaskState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTask ¶
func CreateTask(ctx context.Context, pool *pgxpool.Pool, task taskdef.TaskDefinition) (*string, error)
Sets up a task
func ExecuteTask ¶
func ExecuteTask( ctx context.Context, ctxCancel context.CancelFunc, taskId string, task taskdef.TaskDefinition, prog *TaskProgress, )
Creates a new task on server and executes it
If prog is set, it will be used to cache the task progress, otherwise a blank one will be used
func GetPersistedTaskState ¶
func GetPersistedTaskState(tc *TaskProgress) (*taskstate.Progress, error)
GetPersistedTaskState gets persisted task state from redis
func PersistTaskState ¶
func PersistTaskState(tc *TaskProgress, prog *taskstate.Progress) error
PersistTaskState persists task state to redis temporarily
Types ¶
type MutLogger ¶
func NewTaskLogger ¶
type TaskProgress ¶
type TaskProgress struct { TaskID string TaskState TaskState // Used to cache the current task progress in resumes // // When resuming, set this to the current progress CurrentTaskProgress *taskstate.Progress // OnSetProgress is a callback that is called when SetProgress is called // // If unset, calls PersistTaskState OnSetProgress func(tc *TaskProgress, prog *taskstate.Progress) error }
func (TaskProgress) GetProgress ¶
func (ts TaskProgress) GetProgress() (*taskstate.Progress, error)
func (TaskProgress) SetProgress ¶
func (ts TaskProgress) SetProgress(prog *taskstate.Progress) error
Click to show internal directories.
Click to hide internal directories.