зеркало из https://github.com/golang/build.git
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 <carlos@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Родитель
8f6d74d4ef
Коммит
4fe375cbb0
|
@ -330,6 +330,7 @@ var gcePool = &GCEBuildlet{
|
|||
instQueue: queue.NewQuota(),
|
||||
n2cpuQueue: queue.NewQuota(),
|
||||
n2dcpuQueue: queue.NewQuota(),
|
||||
t2acpuQueue: queue.NewQuota(),
|
||||
}
|
||||
|
||||
var _ Buildlet = (*GCEBuildlet)(nil)
|
||||
|
@ -348,6 +349,7 @@ type GCEBuildlet struct {
|
|||
instQueue *queue.Quota
|
||||
n2cpuQueue *queue.Quota
|
||||
n2dcpuQueue *queue.Quota
|
||||
t2acpuQueue *queue.Quota
|
||||
inst map[string]time.Time // GCE VM instance name -> creationTime
|
||||
}
|
||||
|
||||
|
@ -380,6 +382,8 @@ func (p *GCEBuildlet) pollQuota() {
|
|||
p.n2cpuQueue.UpdateLimit(int(quota.Limit))
|
||||
case "N2D_CPUS":
|
||||
p.n2dcpuQueue.UpdateLimit(int(quota.Limit))
|
||||
case "T2A_CPUS":
|
||||
p.t2acpuQueue.UpdateLimit(int(quota.Limit))
|
||||
case "INSTANCES":
|
||||
p.instQueue.UpdateLimit(int(quota.Limit))
|
||||
}
|
||||
|
@ -392,6 +396,7 @@ func (p *GCEBuildlet) QuotaStats() map[string]*queue.QuotaStats {
|
|||
"gce-c2-cpu": p.c2cpuQueue.ToExported(),
|
||||
"gce-n2-cpu": p.n2cpuQueue.ToExported(),
|
||||
"gce-n2d-cpu": p.n2dcpuQueue.ToExported(),
|
||||
"gce-t2a-cpu": p.t2acpuQueue.ToExported(),
|
||||
"gce-instances": p.instQueue.ToExported(),
|
||||
}
|
||||
}
|
||||
|
@ -545,12 +550,14 @@ func (p *GCEBuildlet) capacityString() string {
|
|||
instUsage := p.instQueue.Quotas()
|
||||
n2Usage := p.n2cpuQueue.Quotas()
|
||||
n2dUsage := p.n2dcpuQueue.Quotas()
|
||||
return fmt.Sprintf("%d/%d instances; %d/%d CPUs, %d/%d C2_CPUS, %d/%d N2_CPUS, %d/%d N2D_CPUS",
|
||||
t2aUsage := p.t2acpuQueue.Quotas()
|
||||
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",
|
||||
instUsage.Used, instUsage.Limit,
|
||||
cpuUsage.Used, cpuUsage.Limit,
|
||||
c2Usage.Used, c2Usage.Limit,
|
||||
n2Usage.Used, n2Usage.Limit,
|
||||
n2dUsage.Used, n2dUsage.Limit)
|
||||
n2dUsage.Used, n2dUsage.Limit,
|
||||
t2aUsage.Used, t2aUsage.Limit)
|
||||
}
|
||||
|
||||
func (p *GCEBuildlet) queueForMachineType(mt string) *queue.Quota {
|
||||
|
@ -560,6 +567,8 @@ func (p *GCEBuildlet) queueForMachineType(mt string) *queue.Quota {
|
|||
return p.n2dcpuQueue
|
||||
} else if strings.HasPrefix(mt, "c2-") {
|
||||
return p.c2cpuQueue
|
||||
} else if strings.HasPrefix(mt, "t2a-") {
|
||||
return p.t2acpuQueue
|
||||
} else {
|
||||
// E2 and N1 instances are counted here. We do not use M1, M2,
|
||||
// or A2 quotas. See
|
||||
|
|
Загрузка…
Ссылка в новой задаче