-
Notifications
You must be signed in to change notification settings - Fork 132
/
interfaces.go
35 lines (31 loc) · 1.06 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package interfaces
import (
v1 "k8s.io/api/core/v1"
"github.com/armadaproject/armada/internal/armada/configuration"
"github.com/armadaproject/armada/internal/scheduler/schedulerobjects"
)
// LegacySchedulerJob is the job interface used throughout the scheduler.
type LegacySchedulerJob interface {
GetId() string
GetQueue() string
GetJobSet() string
GetAnnotations() map[string]string
GetRequirements(map[string]configuration.PriorityClass) *schedulerobjects.JobSchedulingInfo
GetPriorityClassName() string
GetNodeSelector() map[string]string
GetAffinity() *v1.Affinity
GetTolerations() []v1.Toleration
GetResourceRequirements() v1.ResourceRequirements
}
func PodRequirementFromLegacySchedulerJob(job LegacySchedulerJob, priorityClasses map[string]configuration.PriorityClass) *schedulerobjects.PodRequirements {
schedulingInfo := job.GetRequirements(priorityClasses)
if schedulingInfo == nil {
return nil
}
for _, objectReq := range schedulingInfo.ObjectRequirements {
if req := objectReq.GetPodRequirements(); req != nil {
return req
}
}
return nil
}