feat: add ops scheduler control center
This commit is contained in:
@@ -95,14 +95,59 @@ func main() {
|
||||
generationStateCheckWorker := generateworker.NewGenerationTaskStateCheckWorker(app.DB, app.Logger, app.Config().Generation).
|
||||
WithConfigProvider(app.ConfigStore).
|
||||
WithCache(app.Cache)
|
||||
monitoringRetentionWorker := internalscheduler.NewMonitoringRetentionWorker(app.MonitoringDB, app.Logger)
|
||||
|
||||
startSchedulerWorker(ctx, &workerWG, "schedule_dispatch", app.Logger.Sugar(), scheduleDispatchWorker.Run)
|
||||
startSchedulerWorker(ctx, &workerWG, "monitoring_daily_task", app.Logger.Sugar(), monitoringDailyTaskWorker.Run)
|
||||
startSchedulerWorker(ctx, &workerWG, "monitoring_result_recovery", app.Logger.Sugar(), monitoringResultRecoveryWorker.Run)
|
||||
startSchedulerWorker(ctx, &workerWG, "monitoring_lease_recovery", app.Logger.Sugar(), monitoringLeaseRecoveryWorker.Run)
|
||||
startSchedulerWorker(ctx, &workerWG, "monitoring_received_inspection", app.Logger.Sugar(), monitoringReceivedInspectionWorker.Run)
|
||||
startSchedulerWorker(ctx, &workerWG, "knowledge_deleted_cleanup", app.Logger.Sugar(), knowledgeDeletedCleanupWorker.Run)
|
||||
startSchedulerWorker(ctx, &workerWG, "generation_state_check", app.Logger.Sugar(), generationStateCheckWorker.Run)
|
||||
controlPlane := internalscheduler.NewControlPlane(app.DB, app.Logger, []internalscheduler.ControlledJob{
|
||||
{
|
||||
Key: "schedule_dispatch",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return scheduleDispatchWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "monitoring_daily_task",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return monitoringDailyTaskWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "monitoring_result_recovery",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return monitoringResultRecoveryWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "monitoring_lease_recovery",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return monitoringLeaseRecoveryWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "monitoring_received_inspection",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return monitoringReceivedInspectionWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "knowledge_deleted_cleanup",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return knowledgeDeletedCleanupWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "generation_state_check",
|
||||
Run: func(runCtx context.Context, _ internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return generationStateCheckWorker.RunOnce(runCtx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "monitoring_retention_cleanup",
|
||||
Run: func(runCtx context.Context, jobCtx internalscheduler.JobRunContext) (map[string]any, error) {
|
||||
return monitoringRetentionWorker.RunOnce(runCtx, jobCtx)
|
||||
},
|
||||
},
|
||||
})
|
||||
startSchedulerWorker(ctx, &workerWG, "control_plane", app.Logger.Sugar(), controlPlane.Run)
|
||||
|
||||
var metricsServer *http.Server
|
||||
if app.Config().Scheduler.HTTPPort > 0 {
|
||||
|
||||
Reference in New Issue
Block a user