Documentation ¶
Index ¶
- func GetJobsCollectionName(deployment string) string
- func NewBufferedQueue(queueSize uint) chan Job
- func Queue() chan Job
- func SortASC(a, b Job) bool
- func SortDESC(a, b Job) bool
- type Enqueuer
- type Error
- type GenericHandler
- type Job
- type NJobs
- type SortOrder
- type State
- type Status
- type Step
- type WorkerPool
- type Workflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJobsCollectionName ¶
func NewBufferedQueue ¶
NewBufferedQueue : create a buffered channel for queuing jobs
Types ¶
type Enqueuer ¶
type Enqueuer struct { Handler GenericHandler // contains filtered or unexported fields }
func NewEnqueuer ¶
type GenericHandler ¶
type GenericHandler func(args interface{}) error
GenericHandler is a generic job handler that takes in job arguments
type Job ¶
type Job struct { ID string `json:"id"` // Unique job ID Deployment string `json:"deployment"` // Deployment used for scoping jobs. Type string `json:"type"` // The type of job Status Status `json:"status"` // The response of the current job with details for execution counts etc.. State State `json:"state"` // Current state of a job (running | complete) StartTime int64 `json:"start_time_epoch"` // Job Start time - epoch in seconds since 1970 EndTime int64 `json:"end_time_epoch"` // Job end time - epoch in seconds since 1970 RetryPolicy uint `json:"retry_policy"` // Job retry policy Args interface{} `json:"-"` // Arguments passed down to job handlers Setup GenericHandler `json:"-"` // Setup is the initial execution fn for a job typically to setup arguments Run GenericHandler `json:"-"` // Run is the main executor fn for a job Finally GenericHandler `json:"-"` // Final fn is the final execution fn for a job }
type NJobs ¶
type NJobs [][]Job
N dimensional Job array
func (NJobs) MergeAndSort ¶
merge : combines njobs into a single job array sorted in DESCENDING order based on timestamp.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func NewWorkerPool ¶
func NewWorkerPool(concurrency uint, jobChannel chan Job, store store.Store) WorkerPool
NewWorkerPool : create a concurrent pool of workers to process Jobs from the queue
func (*WorkerPool) Start ¶
func (wp *WorkerPool) Start()
Start : all the workers part of the worker pool
func (*WorkerPool) Stop ¶
func (wp *WorkerPool) Stop()
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
func NewWorkflow ¶
NewWorkflow : creates a new workflow
func (*Workflow) Start ¶
Start : executes every Step in a Workflow returns an error if any Step in the Workflow errors out.
func (*Workflow) With ¶
func (wf *Workflow) With(name string, handler GenericHandler)
With : add new step to a workflow
Click to show internal directories.
Click to hide internal directories.