-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
351b315
commit 0978736
Showing
5 changed files
with
115 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package metrics | ||
|
||
import ( | ||
schedulercontext "github.com/armadaproject/armada/internal/scheduler/context" | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
type Metrics struct { | ||
// Indicates whether this instance is the leader. | ||
isLeader prometheus.Gauge | ||
// Scheduling cycle time percentiles. Only exported when leader. | ||
scheduleCycleTime prometheus.Summary | ||
// State reconciliation cycle time percentiles. | ||
reconcileCycleTime prometheus.Summary | ||
// Number of scheduled jobs. | ||
scheduledJobs prometheus.CounterVec | ||
// Number of preempted jobs. | ||
preemptedJobs prometheus.CounterVec | ||
// Number of failed jobs. | ||
failedJobs prometheus.CounterVec | ||
// Number of successful jobs. | ||
succeededJobs prometheus.CounterVec | ||
// Number of jobs considered when scheduling. | ||
consideredJobs prometheus.CounterVec | ||
// Fair share of each queue. | ||
fairSharePerQueue prometheus.GaugeVec | ||
// Actual share of each queue. | ||
actualSharePerQueue prometheus.GaugeVec | ||
// Determines whether to expose specified metrics | ||
disabledMetrics map[prometheus.Collector]bool | ||
} | ||
|
||
func (m *Metrics) Observe(result schedulercontext.SchedulingContext) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package scheduler | ||
|
||
import ( | ||
schedulercontext "github.com/armadaproject/armada/internal/scheduler/context" | ||
"github.com/armadaproject/armada/internal/scheduler/interfaces" | ||
) | ||
|
||
// SchedulerResult is returned by Rescheduler.Schedule(). | ||
type SchedulerResult struct { | ||
// Running jobs that should be preempted. | ||
PreemptedJobs []interfaces.LegacySchedulerJob | ||
// Queued jobs that should be scheduled. | ||
ScheduledJobs []interfaces.LegacySchedulerJob | ||
// Queued jobs that could not be scheduled. | ||
// This is used to fail jobs that could not schedule above `minimumGangCardinality`. | ||
FailedJobs []interfaces.LegacySchedulerJob | ||
// For each preempted job, maps the job id to the id of the node on which the job was running. | ||
// For each scheduled job, maps the job id to the id of the node on which the job should be scheduled. | ||
NodeIdByJobId map[string]string | ||
// Each result may bundle the result of several scheduling decisions. | ||
// These are the corresponding scheduling contexts. | ||
// TODO: This doesn't seem like the right approach. | ||
SchedulingContexts []*schedulercontext.SchedulingContext | ||
} | ||
|
||
// PreemptedJobsFromSchedulerResult returns the slice of preempted jobs in the result cast to type T. | ||
func PreemptedJobsFromSchedulerResult[T interfaces.LegacySchedulerJob](sr *SchedulerResult) []T { | ||
rv := make([]T, len(sr.PreemptedJobs)) | ||
for i, job := range sr.PreemptedJobs { | ||
rv[i] = job.(T) | ||
} | ||
return rv | ||
} | ||
|
||
// ScheduledJobsFromSchedulerResult returns the slice of scheduled jobs in the result cast to type T. | ||
func ScheduledJobsFromSchedulerResult[T interfaces.LegacySchedulerJob](sr *SchedulerResult) []T { | ||
rv := make([]T, len(sr.ScheduledJobs)) | ||
for i, job := range sr.ScheduledJobs { | ||
rv[i] = job.(T) | ||
} | ||
return rv | ||
} | ||
|
||
// FailedJobsFromSchedulerResult returns the slice of scheduled jobs in the result cast to type T. | ||
func FailedJobsFromSchedulerResult[T interfaces.LegacySchedulerJob](sr *SchedulerResult) []T { | ||
rv := make([]T, len(sr.FailedJobs)) | ||
for i, job := range sr.FailedJobs { | ||
rv[i] = job.(T) | ||
} | ||
return rv | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters