Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var HeartbeatInterval = 3 * time.Second
HeartbeatInterval is heartbeat interval for checking worker stage TODO: expose this config in lib
Functions ¶
This section is empty.
Types ¶
type FinishedTaskStatus ¶
type FinishedTaskStatus = metadata.FinishedTaskStatus
FinishedTaskStatus wraps the TaskStatus with FinishedStatus. It only used when a task is finished.
type TaskStatus ¶
type TaskStatus = metadata.TaskStatus
TaskStatus defines the running task status.
func NewOfflineStatus ¶
func NewOfflineStatus(task string) TaskStatus
NewOfflineStatus is used when jobmaster receives a worker offline.
type WorkerStage ¶
type WorkerStage int
WorkerStage represents the stage of a worker.
const ( WorkerCreating WorkerStage = iota + 1 WorkerOnline WorkerFinished WorkerOffline )
All available WorkerStage
func (WorkerStage) MarshalJSON ¶
func (ws WorkerStage) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (WorkerStage) String ¶
func (ws WorkerStage) String() string
String implements fmt.Stringer interface
func (*WorkerStage) UnmarshalJSON ¶
func (ws *WorkerStage) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type WorkerStatus ¶
type WorkerStatus struct { TaskID string ID frameModel.WorkerID Unit framework.WorkerType Stage WorkerStage CfgModRevision uint64 // contains filtered or unexported fields }
WorkerStatus manages worker state machine
func InitWorkerStatus ¶
func InitWorkerStatus(taskID string, unit framework.WorkerType, id frameModel.WorkerID) WorkerStatus
InitWorkerStatus creates a new worker status and initializes it
func NewWorkerStatus ¶
func NewWorkerStatus(taskID string, unit framework.WorkerType, id frameModel.WorkerID, stage WorkerStage, cfgModRevision uint64) WorkerStatus
NewWorkerStatus creates a new WorkerStatus instance
func (*WorkerStatus) CreateFailed ¶
func (w *WorkerStatus) CreateFailed() bool
CreateFailed checks whether the worker creation is failed
func (*WorkerStatus) IsOffline ¶
func (w *WorkerStatus) IsOffline() bool
IsOffline checks whether worker stage is offline
func (*WorkerStatus) IsTombStone ¶
func (w *WorkerStatus) IsTombStone() bool
IsTombStone returns whether the worker is tombstone, which means we don't need to stop it.
func (*WorkerStatus) RunAsExpected ¶
func (w *WorkerStatus) RunAsExpected() bool
RunAsExpected returns whether a worker is running. Currently, we regard worker run as expected except it is offline.