Documentation
¶
Overview ¶
Package runner implements running a job.
Index ¶
Constants ¶
View Source
const ( // Number of times to attempt sending a job log to the RM. JOB_LOG_TRIES = 3 // Time to wait between attempts to send a job log to RM. JOB_LOG_RETRY_WAIT = 500 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface {
Make(job proto.Job, requestId string, prevTries uint, prevSeqTries uint, sequenceRetry uint) (Runner, error)
}
A Factory takes a proto.Job, creates a corresponding job.Job interface for it, and passes both to NewRunner to make a Runner.
type Repo ¶
type Repo interface {
Set(jobId string, runner Runner)
Remove(jobId string)
Items() (map[string]Runner, error)
Count() int
}
Repo is a small wrapper around a concurrent map that provides the ability to store and retrieve Runners in a thread-safe way.
type Runner ¶
type Runner interface {
// Run runs the job, blocking until it has completed or when Stop is called.
// If the job fails, Run will retry it as many times as the job is configured
// to be retried. After each run attempt, a Job Log is created and sent to
// the RM. When the job successfully completes, or reaches the maximum number
// of retry attempts, Run returns the final state of the job.
Run(jobData map[string]interface{}) Return
// Stop stops the job if it's running. The job is responsible for stopping
// quickly because Stop blocks while waiting for the job to stop.
Stop() error
// Status returns the status of the job as reported by the job. The job
// is responsible for handling status requests asynchronously while running.
Status() string
}
A Runner runs and manages one job in a job chain. The job must implement the job.Job interface.
Click to show internal directories.
Click to hide internal directories.