Documentation ¶
Index ¶
- Constants
- func BuildMasterActorProps(componentName string, componentID string, logger Logger, ...) *actor.Props
- func BuildRunnerActorProps(logger Logger, jobID string, j *job.Job) *actor.Props
- func BuildWorkerActorProps(componentName, componentID string, logger Logger, j *job.Job, ...) *actor.Props
- type Execute
- type IDGenerator
- type LockManager
- type Logger
- type MasterActor
- type MasterOption
- type RegisterJob
- type RunnerActor
- type RunnerStarted
- type RunnerStopped
- type StartJob
- type Status
- type StatusManager
- type StepStatus
- type WorkerActor
- type WorkerOption
Constants ¶
const ( Completed = "COMPLETED" Failed = "FAILED" )
Job execution status
Variables ¶
This section is empty.
Functions ¶
func BuildMasterActorProps ¶
func BuildMasterActorProps(componentName string, componentID string, logger Logger, options ...MasterOption) *actor.Props
BuildMasterActorProps build the Properties for the actor spawning.
func BuildRunnerActorProps ¶
BuildRunnerActorProps build the Properties for the actor spawning.
func BuildWorkerActorProps ¶
func BuildWorkerActorProps(componentName, componentID string, logger Logger, j *job.Job, idGenerator IDGenerator, lm LockManager, sm StatusManager, options ...WorkerOption) *actor.Props
BuildWorkerActorProps build the Properties for the actor spawning.
Types ¶
type Execute ¶
type Execute struct{}
Execute message is sent by MasterActor to command to WorkerActor to launch the execution of the job.
type IDGenerator ¶
type IDGenerator interface {
NextID() string
}
IDGenerator is used to compute a unique identifier for component instance and job execution instance.
type LockManager ¶
type LockManager interface { Unlock(componentName string, componentID string, jobName string, jobID string) error Lock(componentName string, componentID string, jobName string, jobID string, jobMaxDuration time.Duration) error }
LockManager is the lock policy to prevent concurrent job execution.
type MasterActor ¶
type MasterActor struct {
// contains filtered or unexported fields
}
MasterActor is the main actor for jobs execution. It handles unexpected Workers crashes.
func (*MasterActor) Receive ¶
func (state *MasterActor) Receive(context actor.Context)
Receive is the implementation of MasterActor's behavior
type MasterOption ¶
type MasterOption func(m *MasterActor)
MasterOption is configuration option for MasterActor
type RegisterJob ¶
type RegisterJob struct { Job *job.Job IDGenerator IDGenerator LockManager LockManager StatusManager StatusManager }
RegisterJob is the message received by MasterActor to register a new job. IDGenerator and LockManager must be not nil, StatusManager can be nil.
type RunnerActor ¶
type RunnerActor struct {
// contains filtered or unexported fields
}
RunnerActor is the actor in charge of the job execution It has a state with the job in order to be able to automatically restart it if panic occurs.
func (*RunnerActor) Receive ¶
func (state *RunnerActor) Receive(ctx actor.Context)
Receive is the implementation of RunnerActor's behavior
type RunnerStarted ¶
type RunnerStarted struct {
JobID string
}
RunnerStarted message is sent by RunnerActor to Worker to notify it has started
type RunnerStopped ¶
type RunnerStopped struct {
JobID string
}
RunnerStopped message is sent by RunnerActor to Worker to notify its shutdown
type StartJob ¶
type StartJob struct {
JobName string
}
StartJob is a message received by MasterActor to launch the execution of a job.
type Status ¶
type Status struct { JobID string // contains filtered or unexported fields }
Status message is sent by RunnerActor to inform the Worker about its final execution status.
type StatusManager ¶
type StatusManager interface { Start(componentName, componentID, jobName string) error Update(componentName, componentID, jobName string, stepInfos map[string]string) error Complete(componentName, componentID, jobName, jobID string, stepInfos, message map[string]string) error Fail(componentName, componentID, jobName, jobID string, stepInfos, message map[string]string) error Register(componentName, componentID, jobName, jobID string) }
StatusManager is the component used to persist information about job executions.
type StepStatus ¶
StepStatus message is sent by RunnerActor to give sign of live to the Worker and inform about its current status.
type WorkerActor ¶
type WorkerActor struct {
// contains filtered or unexported fields
}
WorkerActor is the actor responsibles of the execution of a specific job. It checks the locks, persist the status if enabled. Handles timeout and unexpected failures of RunnerActor.
func (*WorkerActor) Receive ¶
func (state *WorkerActor) Receive(context actor.Context)
Receive is the implementation of WorkerActor's behavior
type WorkerOption ¶
type WorkerOption func(w *WorkerActor)
WorkerOption to configure the WorkerActor.