Skip to content

Commit 4fe375c

Browse files
committed
internal/coordinator/pool: add GCP t2a instance quotas
This adds the ability to track quota for t2a instances which have an ARM64 architecture. This is required functionality if the coordinator makes use of this machine type. Updates golang/go#53851 Change-Id: I5fd384fee78bd1817fb022e67ecaa3e405977e3b Reviewed-on: https://go-review.googlesource.com/c/build/+/447260 Run-TryBot: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 8f6d74d commit 4fe375c

File tree

1 file changed

+11
-2
lines changed
  • internal/coordinator/pool

1 file changed

+11
-2
lines changed

internal/coordinator/pool/gce.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ var gcePool = &GCEBuildlet{
330330
instQueue: queue.NewQuota(),
331331
n2cpuQueue: queue.NewQuota(),
332332
n2dcpuQueue: queue.NewQuota(),
333+
t2acpuQueue: queue.NewQuota(),
333334
}
334335

335336
var _ Buildlet = (*GCEBuildlet)(nil)
@@ -348,6 +349,7 @@ type GCEBuildlet struct {
348349
instQueue *queue.Quota
349350
n2cpuQueue *queue.Quota
350351
n2dcpuQueue *queue.Quota
352+
t2acpuQueue *queue.Quota
351353
inst map[string]time.Time // GCE VM instance name -> creationTime
352354
}
353355

@@ -380,6 +382,8 @@ func (p *GCEBuildlet) pollQuota() {
380382
p.n2cpuQueue.UpdateLimit(int(quota.Limit))
381383
case "N2D_CPUS":
382384
p.n2dcpuQueue.UpdateLimit(int(quota.Limit))
385+
case "T2A_CPUS":
386+
p.t2acpuQueue.UpdateLimit(int(quota.Limit))
383387
case "INSTANCES":
384388
p.instQueue.UpdateLimit(int(quota.Limit))
385389
}
@@ -392,6 +396,7 @@ func (p *GCEBuildlet) QuotaStats() map[string]*queue.QuotaStats {
392396
"gce-c2-cpu": p.c2cpuQueue.ToExported(),
393397
"gce-n2-cpu": p.n2cpuQueue.ToExported(),
394398
"gce-n2d-cpu": p.n2dcpuQueue.ToExported(),
399+
"gce-t2a-cpu": p.t2acpuQueue.ToExported(),
395400
"gce-instances": p.instQueue.ToExported(),
396401
}
397402
}
@@ -545,12 +550,14 @@ func (p *GCEBuildlet) capacityString() string {
545550
instUsage := p.instQueue.Quotas()
546551
n2Usage := p.n2cpuQueue.Quotas()
547552
n2dUsage := p.n2dcpuQueue.Quotas()
548-
return fmt.Sprintf("%d/%d instances; %d/%d CPUs, %d/%d C2_CPUS, %d/%d N2_CPUS, %d/%d N2D_CPUS",
553+
t2aUsage := p.t2acpuQueue.Quotas()
554+
return fmt.Sprintf("%d/%d instances; %d/%d CPUs, %d/%d C2_CPUS, %d/%d N2_CPUS, %d/%d N2D_CPUS %d/%d T2A_CPUS",
549555
instUsage.Used, instUsage.Limit,
550556
cpuUsage.Used, cpuUsage.Limit,
551557
c2Usage.Used, c2Usage.Limit,
552558
n2Usage.Used, n2Usage.Limit,
553-
n2dUsage.Used, n2dUsage.Limit)
559+
n2dUsage.Used, n2dUsage.Limit,
560+
t2aUsage.Used, t2aUsage.Limit)
554561
}
555562

556563
func (p *GCEBuildlet) queueForMachineType(mt string) *queue.Quota {
@@ -560,6 +567,8 @@ func (p *GCEBuildlet) queueForMachineType(mt string) *queue.Quota {
560567
return p.n2dcpuQueue
561568
} else if strings.HasPrefix(mt, "c2-") {
562569
return p.c2cpuQueue
570+
} else if strings.HasPrefix(mt, "t2a-") {
571+
return p.t2acpuQueue
563572
} else {
564573
// E2 and N1 instances are counted here. We do not use M1, M2,
565574
// or A2 quotas. See

0 commit comments

Comments
 (0)