Documentation ¶
Index ¶
Constants ¶
View Source
const ( // JobKindGeneric : Kind of generic job JobKindGeneric = "Generic" // JobKindScheduled : Kind of scheduled job JobKindScheduled = "Scheduled" // JobKindPeriodic : Kind of periodic job JobKindPeriodic = "Periodic" )
View Source
const ( // JobStatusPending : job status pending JobStatusPending = "Pending" // JobStatusRunning : job status running JobStatusRunning = "Running" // JobStatusStopped : job status stopped JobStatusStopped = "Stopped" // JobStatusCancelled : job status cancelled JobStatusCancelled = "Cancelled" // JobStatusError : job status error JobStatusError = "Error" // JobStatusSuccess : job status success JobStatusSuccess = "Success" // JobStatusScheduled : job status scheduled JobStatusScheduled = "Scheduled" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckInFunc ¶ added in v1.5.0
type CheckInFunc func(message string)
CheckInFunc is designed for job to report more detailed progress info
type CheckOPCmdFunc ¶ added in v1.5.0
CheckOPCmdFunc is the function to check if the related operation commands like STOP or CANCEL is fired for the specified job. If yes, return the command code for job to determine if take corresponding action.
type Interface ¶ added in v1.5.0
type Interface interface { // Declare how many times the job can be retried if failed. // // Return: // uint: the failure count allowed. If it is set to 0, then default value 4 is used. MaxFails() uint // Tell the worker pool if retry the failed job when the fails is // still less that the number declared by the method 'MaxFails'. // // Returns: // true for retry and false for none-retry ShouldRetry() bool // Indicate whether the parameters of job are valid. // // Return: // error if parameters are not valid. NOTES: If no parameters needed, directly return nil. Validate(params map[string]interface{}) error // Run the business logic here. // The related arguments will be injected by the workerpool. // // ctx env.JobContext : Job execution context. // params map[string]interface{} : parameters with key-pair style for the job execution. // // Returns: // error if failed to run. NOTES: If job is stopped or cancelled, a specified error should be returned // Run(ctx env.JobContext, params map[string]interface{}) error }
Interface defines the related injection and run entry methods.
type LaunchJobFunc ¶ added in v1.7.0
type LaunchJobFunc func(req models.JobRequest) (models.JobStats, error)
LaunchJobFunc is designed to launch sub jobs in the job
Click to show internal directories.
Click to hide internal directories.