proto

package
v0.0.0-...-503c688 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskStatePending       = "pending"
	TaskStateRunning       = "running"
	TaskStateSucceed       = "succeed"
	TaskStateReverting     = "reverting"
	TaskStateFailed        = "failed"
	TaskStateRevertFailed  = "revert_failed"
	TaskStateCancelling    = "cancelling"
	TaskStateCanceled      = "canceled"
	TaskStatePausing       = "pausing"
	TaskStatePaused        = "paused"
	TaskStateRevertPending = "revert_pending"
	TaskStateReverted      = "reverted"
)

task state machine

  1. succeed: pending -> running -> succeed
  2. failed: pending -> running -> reverting -> reverted/revert_failed
  3. canceled: pending -> running -> cancelling -> reverting -> reverted/revert_failed
  4. pause/resume: pending -> running -> pausing -> paused -> running

subtask state machine

  1. succeed/failed: pending -> running -> succeed/failed
  2. canceled: pending -> running -> canceled
  3. rollback: revert_pending -> reverting -> reverted/revert_failed
  4. pause/resume: pending -> running -> paused -> running
View Source
const (
	StepInit int64 = -1
	StepOne  int64 = 1
	StepTwo  int64 = 2
)

TaskStep is the step of task.

View Source
const (
	// TaskTypeExample is TaskType of Example.
	TaskTypeExample = "Example"
	// LoadData is TaskType of LoadData.
	LoadData = "LoadData"
)

Variables

This section is empty.

Functions

func Int2Type

func Int2Type(i int) string

Int2Type converts int to task type.

func Type2Int

func Type2Int(t string) int

Type2Int converts task type to int.

Types

type MinimalTask

type MinimalTask interface {
	// IsMinimalTask is a marker to check if it is a minimal task for compiler.
	IsMinimalTask()
}

MinimalTask is the minimal task of distribute framework. Each subtask is divided into multiple minimal tasks by scheduler.

type Subtask

type Subtask struct {
	ID          int64
	Type        string
	TaskID      int64
	State       string
	SchedulerID string
	StartTime   uint64
	EndTime     time.Time
	Meta        []byte
}

Subtask represents the subtask of distribute framework. Each task is divided into multiple subtasks by dispatcher.

func NewSubtask

func NewSubtask(taskID int64, tp, schedulerID string, meta []byte) *Subtask

NewSubtask create a new subtask.

type Task

type Task struct {
	ID              int64
	Key             string
	Type            string
	State           string
	Step            int64
	DispatcherID    string
	Concurrency     uint64
	StartTime       time.Time
	StateUpdateTime time.Time
	Meta            []byte
	Error           []byte
}

Task represents the task of distribute framework.

func (*Task) IsFinished

func (t *Task) IsFinished() bool

IsFinished checks if the task is finished.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL