Skip to content

Commit 85b2993

Browse files
committed
wip
1 parent 2cf6179 commit 85b2993

File tree

15 files changed

+973
-594
lines changed

15 files changed

+973
-594
lines changed

.run/Scheduler.run.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

internal/common/eventutil/eventutil.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ func ApiJobFromLogSubmitJob(ownerId string, groups []string, queueName string, j
160160
podSpecs = k8sPodSpecs
161161
}
162162

163+
var priceInfo *api.ExperimentalPriceInfo
164+
if e.PriceInfo != nil {
165+
priceInfo = &api.ExperimentalPriceInfo{
166+
BidPrice: e.PriceInfo.BidPrice,
167+
}
168+
}
169+
163170
return &api.Job{
164171
Id: e.JobId,
165172
ClientId: e.DeduplicationId,
@@ -172,7 +179,7 @@ func ApiJobFromLogSubmitJob(ownerId string, groups []string, queueName string, j
172179

173180
K8SIngress: k8sIngresses,
174181
K8SService: k8sServices,
175-
Price: e.Price,
182+
PriceInfo: priceInfo,
176183
Priority: float64(e.Priority),
177184

178185
PodSpec: podSpec,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE jobs ADD COLUMN bid_price double precision NOT NULL DEFAULT 0;

internal/scheduler/database/migrations/018_add_validated.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

internal/scheduler/database/models.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/scheduler/database/query.sql.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/scheduler/jobdb/reconciliation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (jobDb *JobDb) schedulerJobFromDatabaseJob(dbJob *database.Job) (*Job, erro
260260
dbJob.JobSet,
261261
dbJob.Queue,
262262
uint32(dbJob.Priority),
263-
dbJob.Price,
263+
dbJob.BidPrice,
264264
schedulingInfo,
265265
dbJob.Queued,
266266
dbJob.QueuedVersion,

internal/scheduler/scheduling/preempting_queue_scheduler.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (sch *PreemptingQueueScheduler) evict(ctx *armadacontext.Context, evictor *
320320
if err := sch.nodeDb.Reset(); err != nil {
321321
return nil, nil, err
322322
}
323-
if err := addEvictedJobsToNodeDb(ctx, sch.schedulingContext, sch.nodeDb, inMemoryJobRepo, sch.marketDriven); err != nil {
323+
if err := sch.addEvictedJobsToNodeDb(ctx, inMemoryJobRepo); err != nil {
324324
return nil, nil, err
325325
}
326326
return result, inMemoryJobRepo, nil
@@ -492,7 +492,8 @@ func (q MinimalQueue) GetWeight() float64 {
492492

493493
// addEvictedJobsToNodeDb adds evicted jobs to the NodeDb.
494494
// Needed to enable the nodeDb accounting for these when preempting.
495-
func addEvictedJobsToNodeDb(_ *armadacontext.Context, sctx *schedulercontext.SchedulingContext, nodeDb *nodedb.NodeDb, inMemoryJobRepo *InMemoryJobRepository, marketDriven bool) error {
495+
func (sch *PreemptingQueueScheduler) addEvictedJobsToNodeDb(_ *armadacontext.Context, inMemoryJobRepo *InMemoryJobRepository) error {
496+
sctx := sch.schedulingContext
496497
gangItByQueue := make(map[string]*QueuedGangIterator)
497498
for _, qctx := range sch.schedulingContext.QueueSchedulingContexts {
498499
gangItByQueue[qctx.Queue] = NewQueuedGangIterator(
@@ -502,11 +503,11 @@ func addEvictedJobsToNodeDb(_ *armadacontext.Context, sctx *schedulercontext.Sch
502503
false,
503504
)
504505
}
505-
qr := NewMinimalQueueRepositoryFromSchedulingContext(sctx)
506+
qr := NewMinimalQueueRepositoryFromSchedulingContext(sch.schedulingContext)
506507
var candidateGangIterator CandidateGangIterator
507508
var err error
508-
if marketDriven {
509-
candidateGangIterator, err = NewCostBasedCandidateGangIterator(sctx.Pool, sctx, sctx.FairnessCostProvider, gangItByQueue, false)
509+
if sch.marketDriven {
510+
candidateGangIterator, err = NewCostBasedCandidateGangIterator(sctx.Pool, sctx, sctx.FairnessCostProvider, gangItByQueue, false, sch.preferLargeJobOrdering)
510511
if err != nil {
511512
return err
512513
}
@@ -516,8 +517,7 @@ func addEvictedJobsToNodeDb(_ *armadacontext.Context, sctx *schedulercontext.Sch
516517
return err
517518
}
518519
}
519-
520-
txn := nodeDb.Txn(true)
520+
txn := sch.nodeDb.Txn(true)
521521
defer txn.Abort()
522522
i := 0
523523
for {

internal/scheduler/scheduling/queue_scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func NewQueueScheduler(
6868
return nil, err
6969
}
7070
} else {
71-
candidateGangIterator, err = NewCostBasedCandidateGangIterator(sctx.Pool, sctx, sctx.FairnessCostProvider, gangIteratorsByQueue, considerPriorityClassPriority)
71+
candidateGangIterator, err = NewCostBasedCandidateGangIterator(sctx.Pool, sctx, sctx.FairnessCostProvider, gangIteratorsByQueue, considerPriorityClassPriority, prioritiseLargerJobs)
7272
if err != nil {
7373
return nil, err
7474
}

pkg/api/api.swagger.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,15 @@ func SwaggerJsonTemplate() string {
788788
" }\n" +
789789
" }\n" +
790790
" },\n" +
791+
" \"apiExperimentalPriceInfo\": {\n" +
792+
" \"type\": \"object\",\n" +
793+
" \"properties\": {\n" +
794+
" \"bidPrice\": {\n" +
795+
" \"type\": \"number\",\n" +
796+
" \"format\": \"double\"\n" +
797+
" }\n" +
798+
" }\n" +
799+
" },\n" +
791800
" \"apiIngressConfig\": {\n" +
792801
" \"type\": \"object\",\n" +
793802
" \"properties\": {\n" +
@@ -892,9 +901,8 @@ func SwaggerJsonTemplate() string {
892901
" \"$ref\": \"#/definitions/v1PodSpec\"\n" +
893902
" }\n" +
894903
" },\n" +
895-
" \"price\": {\n" +
896-
" \"type\": \"number\",\n" +
897-
" \"format\": \"double\"\n" +
904+
" \"priceInfo\": {\n" +
905+
" \"$ref\": \"#/definitions/apiExperimentalPriceInfo\"\n" +
898906
" },\n" +
899907
" \"priority\": {\n" +
900908
" \"type\": \"number\",\n" +

0 commit comments

Comments
 (0)