Documentation ¶
Index ¶
- Constants
- Variables
- func Leader() string
- func Run(pctx context.Context)
- type AgentExecution
- type AgentMonitor
- type AgentUpdate
- type Agents
- type Dispatcher
- type DispatcherEvent
- type Execution
- type JobDispatchState
- type JobDispatcher
- func (jd *JobDispatcher) AgentDown(node string)
- func (jd *JobDispatcher) AgentUp(node string)
- func (jd *JobDispatcher) AgentsCompleted(res *JobExecutionResult)
- func (jd *JobDispatcher) Concurrency() int
- func (jd *JobDispatcher) DependencyCompleted(res *JobExecutionResult)
- func (jd *JobDispatcher) Name() string
- func (jd *JobDispatcher) Serve()
- func (jd *JobDispatcher) Stop()
- type JobDispatcherManager
- type JobExecution
- func (jobExec *JobExecution) GetMaxGroupIds(names []string) map[string]int64
- func (jobExec *JobExecution) JobCompleted(res *JobExecutionResult)
- func (jobExec *JobExecution) JobDeleted(jobName string)
- func (jobExec *JobExecution) Subscribe(jobDisp Dispatcher, dependents []string)
- func (jobExec *JobExecution) Unsubscribe(jobDisp Dispatcher, dependents []string)
- type JobExecutionResult
Constants ¶
View Source
const ( DependentExecutionEvent = iota JobExecutionEvent AgentDownEvent AgentUpEvent )
Variables ¶
View Source
var ( // AgentManager Agents manager AgentManager Agents // JobExecutions Job execution results JobExecutions Execution // JobDispatchers Job dispatcher manager JobDispatchers *JobDispatcherManager )
Functions ¶
Types ¶
type AgentExecution ¶
type AgentExecution struct {
// contains filtered or unexported fields
}
AgentExectuion 执行结果处理
func NewAgentExecution ¶
func NewAgentExecution(pctx context.Context, jd Dispatcher) *AgentExecution
NewAgentExecution 新建执行结果处理程序 每个 JobDispatcher 一个
type AgentMonitor ¶
func (*AgentMonitor) Check ¶
func (m *AgentMonitor) Check(agent string) bool
type AgentUpdate ¶
type Agents ¶
func NewAgentMonitor ¶
func NewAgentMonitor(pctx context.Context, callback AgentUpdate) Agents
type Dispatcher ¶
type Dispatcher interface { // agent node up/down notification AgentUp(string) AgentDown(string) // dispatcher properties Name() string Name() string Concurrency() int // operations Serve() Stop() // agent/job results notification DependencyCompleted(*JobExecutionResult) AgentsCompleted(*JobExecutionResult) }
func NewJobDispatcher ¶
func NewJobDispatcher(ctx context.Context, job *logic.JobConfig) Dispatcher
type DispatcherEvent ¶
type DispatcherEvent struct { EventType int EventData interface{} }
type Execution ¶
type Execution interface { // Get jobs execution group id GetMaxGroupIds([]string) map[string]int64 // Job complete notify JobCompleted(*JobExecutionResult) JobDeleted(string) // Subscribe/Unsubscribe job complete events Subscribe(Dispatcher, []string) Unsubscribe(Dispatcher, []string) }
func NewJobExecution ¶
type JobDispatchState ¶
type JobDispatchState struct { // job dependents state Dependents map[string]int64 `json:"dependents"` // job running agents state // map[node]map[dispatch id]ok RunningAgents map[string]map[string]bool `json:"running_agents"` // job all completed state // will not dispatch again JobCompleted bool `json:"job_completed"` }
func (*JobDispatchState) RunningCount ¶
func (jds *JobDispatchState) RunningCount() int
func (*JobDispatchState) ToString ¶
func (jds *JobDispatchState) ToString() (string, error)
type JobDispatcher ¶
type JobDispatcher struct {
// contains filtered or unexported fields
}
func (*JobDispatcher) AgentDown ¶
func (jd *JobDispatcher) AgentDown(node string)
func (*JobDispatcher) AgentUp ¶
func (jd *JobDispatcher) AgentUp(node string)
func (*JobDispatcher) AgentsCompleted ¶
func (jd *JobDispatcher) AgentsCompleted(res *JobExecutionResult)
func (*JobDispatcher) Concurrency ¶
func (jd *JobDispatcher) Concurrency() int
func (*JobDispatcher) DependencyCompleted ¶
func (jd *JobDispatcher) DependencyCompleted(res *JobExecutionResult)
func (*JobDispatcher) Name ¶
func (jd *JobDispatcher) Name() string
func (*JobDispatcher) Serve ¶
func (jd *JobDispatcher) Serve()
type JobDispatcherManager ¶
func NewJobDispatcherManager ¶
func NewJobDispatcherManager(pctx context.Context) *JobDispatcherManager
func (*JobDispatcherManager) AgentDown ¶
func (mgr *JobDispatcherManager) AgentDown(node string, tags []string)
func (*JobDispatcherManager) AgentUp ¶
func (mgr *JobDispatcherManager) AgentUp(node string, tags []string)
func (*JobDispatcherManager) Serve ¶
func (mgr *JobDispatcherManager) Serve()
type JobExecution ¶
func (*JobExecution) GetMaxGroupIds ¶
func (jobExec *JobExecution) GetMaxGroupIds(names []string) map[string]int64
func (*JobExecution) JobCompleted ¶
func (jobExec *JobExecution) JobCompleted(res *JobExecutionResult)
func (*JobExecution) JobDeleted ¶
func (jobExec *JobExecution) JobDeleted(jobName string)
func (*JobExecution) Subscribe ¶
func (jobExec *JobExecution) Subscribe(jobDisp Dispatcher, dependents []string)
func (*JobExecution) Unsubscribe ¶
func (jobExec *JobExecution) Unsubscribe(jobDisp Dispatcher, dependents []string)
type JobExecutionResult ¶
type JobExecutionResult struct { logic.ExecutionResult DispatchIDs []string `json:"dispatch_ids"` // Number of successful executions of this job. SuccessCount int `json:"success_count"` // Number of errors running this job. ErrorCount int `json:"error_count"` // Last time this job executed successful. LastSuccess time.Time `json:"last_success"` // Last time this job failed. LastError time.Time `json:"last_error"` }
Click to show internal directories.
Click to hide internal directories.