Skip to content

Commit

Permalink
Merge branch 'master' into scheduler_config_updae
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMurkin committed Jun 22, 2023
2 parents 34d137b + f869cea commit 966c004
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion client/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = { text = "Apache Software License" }
authors = [{ name = "G-Research Open Source Software", email = "armada@armadaproject.io" }]

[project.optional-dependencies]
format = ["black==23.3.0", "flake8==6.0.0", "pylint==2.17.3"]
format = ["black==23.3.0", "flake8==6.0.0", "pylint==2.17.4"]
docs = ["sphinx", "sphinx-jekyll-builder", "sphinx-toolbox==3.2.0b1"]
test = ["pytest==7.3.1", "coverage>=6.5.0", "pytest-asyncio==0.21.0"]

Expand Down
10 changes: 1 addition & 9 deletions cmd/armada-load-tester/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ var rootCmd = &cobra.Command{
Command line utility to submit many jobs to armada
Persistent config can be saved in a config file so it doesn't have to be specified every command.
Example structure:
armadaUrl: localhost:50051
basicAuth:
username: user1
password: password123
The location of this file can be passed in using --config argument or picked from $HOME/.armadactl.yaml.
`,
The location of this file can be passed in using --config argument or picked from $HOME/.armadactl.yaml.`,
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
7 changes: 0 additions & 7 deletions cmd/testsuite/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ func RootCmd() *cobra.Command {
Long: `testsuite is a suite of automated tests for Armada deployments.
Persistent config can be saved in a config file so it doesn't have to be specified every command.
Example structure:
armadaUrl: localhost:50051
basicAuth:
username: user1
password: password123
The location of this file can be passed in using the --config argument.
If not provided, $HOME/.armadactl.yaml is used.`,
}
Expand Down
3 changes: 3 additions & 0 deletions internal/armada/configuration/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ type PriorityClass struct {
// jobs of this priority class are not scheduled if doing so would cause the total resources assigned
// to jobs of priority 10 or lower from the same queue to exceed 30% of the total.
MaximumResourceFractionPerQueue map[string]float64
// Per-pool override of MaximumResourceFractionPerQueue.
// If missing for a particular pool, MaximumResourceFractionPerQueue is used instead for that pool.
MaximumResourceFractionPerQueueByPool map[string]map[string]float64
}

func (p PreemptionConfig) PriorityByPriorityClassName() map[string]int32 {
Expand Down
4 changes: 3 additions & 1 deletion internal/armada/server/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ func (q *AggregatedQueueServer) getJobs(ctx context.Context, req *api.StreamingL
activeClusterReports := scheduling.FilterActiveClusters(usageReports)
totalCapacity := make(armadaresource.ComputeResources)
for _, clusterReport := range activeClusterReports {
totalCapacity.Add(util.GetClusterAvailableCapacity(clusterReport))
if clusterReport.Pool == req.Pool {
totalCapacity.Add(util.GetClusterAvailableCapacity(clusterReport))
}
}

// Collect all allowed priorities.
Expand Down
2 changes: 1 addition & 1 deletion internal/armada/server/submit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ func withSubmitServerAndRepos(action func(s *SubmitServer, jobRepo repository.Jo
MaxPodSpecSizeBytes: 65535,
Preemption: configuration.PreemptionConfig{
DefaultPriorityClass: "high",
PriorityClasses: map[string]configuration.PriorityClass{"high": {0, false, nil}},
PriorityClasses: map[string]configuration.PriorityClass{"high": {0, false, nil, nil}},
},
MinTerminationGracePeriod: time.Duration(30 * time.Second),
MaxTerminationGracePeriod: time.Duration(300 * time.Second),
Expand Down
8 changes: 4 additions & 4 deletions internal/scheduler/adapters/adapters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

var (
priorityByPriorityClassName = map[string]configuration.PriorityClass{
"priority-0": {0, true, nil},
"priority-1": {1, true, nil},
"priority-2": {2, true, nil},
"priority-3": {3, false, nil},
"priority-0": {0, true, nil, nil},
"priority-1": {1, true, nil, nil},
"priority-2": {2, true, nil, nil},
"priority-3": {3, false, nil, nil},
}

priority int32 = 1
Expand Down
12 changes: 9 additions & 3 deletions internal/scheduler/constraints/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,21 @@ func SchedulingConstraintsFromSchedulingConfig(
) SchedulingConstraints {
priorityClassSchedulingConstraintsByPriorityClassName := make(map[string]PriorityClassSchedulingConstraints, len(config.Preemption.PriorityClasses))
for name, priorityClass := range config.Preemption.PriorityClasses {
maximumResourceFractionPerQueue := priorityClass.MaximumResourceFractionPerQueue
if m, ok := priorityClass.MaximumResourceFractionPerQueueByPool[pool]; ok {
// Use pool-specific config is available.
maximumResourceFractionPerQueue = m
}
priorityClassSchedulingConstraintsByPriorityClassName[name] = PriorityClassSchedulingConstraints{
PriorityClassName: name,
PriorityClassPriority: priorityClass.Priority,
MaximumCumulativeResourcesPerQueue: absoluteFromRelativeLimits(totalResources, priorityClass.MaximumResourceFractionPerQueue),
MaximumCumulativeResourcesPerQueue: absoluteFromRelativeLimits(totalResources, maximumResourceFractionPerQueue),
}
}
maximumResourceFractionToSchedule := config.MaximumResourceFractionToSchedule
if limit, ok := config.MaximumResourceFractionToScheduleByPool[pool]; ok {
maximumResourceFractionToSchedule = limit
if m, ok := config.MaximumResourceFractionToScheduleByPool[pool]; ok {
// Use pool-specific config is available.
maximumResourceFractionToSchedule = m
}
return SchedulingConstraints{
MaximumJobsToSchedule: config.MaximumJobsToSchedule,
Expand Down

0 comments on commit 966c004

Please sign in to comment.