Skip to content

Commit

Permalink
add leader check
Browse files Browse the repository at this point in the history
  • Loading branch information
theAntiYeti committed Aug 16, 2023
1 parent fd7cb40 commit 1a00553
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions internal/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,15 @@ func (s *Scheduler) cycle(ctx context.Context, updateAll bool, leaderToken Leade
return err
}

// Report counts of scheduled jobs per queue.
// TODO: preemptible jobs, possibly other metrics here.
s.metrics.ReportScheduledJobs(overallSchedulerResult.ScheduledJobs)
s.metrics.ReportPreemptedJobs(overallSchedulerResult.PreemptedJobs)
// This check feels redundant. It feels like we shouldn't have got here without
// a leader token.
if leaderToken.leader {
// Report various metrics computed from the scheduling cycle.
// TODO: preemptible jobs, possibly other metrics
// TODO: Return this information and deal with metrics after the cycle?
s.metrics.ReportScheduledJobs(overallSchedulerResult.ScheduledJobs)
s.metrics.ReportPreemptedJobs(overallSchedulerResult.PreemptedJobs)
}

resultEvents, err := s.eventsFromSchedulerResult(txn, overallSchedulerResult)
if err != nil {
Expand Down

0 comments on commit 1a00553

Please sign in to comment.