-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/coordinator,internal/coordinator: add queue UI
This adds a UI for viewing what builds are in each queue. For golang/go#48857 Change-Id: I025d01510833cc9c0d23556d7f90a62119eb39fb Reviewed-on: https://go-review.googlesource.com/c/build/+/419429 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Run-TryBot: Jenny Rakoczy <[email protected]> Auto-Submit: Jenny Rakoczy <[email protected]>
- Loading branch information
Showing
9 changed files
with
224 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2022 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
//go:build go1.16 && (linux || darwin) | ||
// +build go1.16 | ||
// +build linux darwin | ||
|
||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"html/template" | ||
"log" | ||
"net/http" | ||
|
||
"golang.org/x/build/internal/coordinator/pool" | ||
"golang.org/x/build/internal/coordinator/pool/queue" | ||
) | ||
|
||
//go:embed queues.html | ||
var queuesTemplateStr string | ||
|
||
var queuesTemplate = template.Must(baseTmpl.New("queues.html").Parse(queuesTemplateStr)) | ||
|
||
type QueuesResponse struct { | ||
Queues map[string]*queue.QuotaStats | ||
} | ||
|
||
func handleQueues(w http.ResponseWriter, _ *http.Request) { | ||
resp := QueuesResponse{Queues: map[string]*queue.QuotaStats{}} | ||
mergeStats := func(qs map[string]*queue.QuotaStats) { | ||
for name, stats := range qs { | ||
resp.Queues[name] = stats | ||
} | ||
} | ||
mergeStats(pool.ReversePool().QuotaStats()) | ||
mergeStats(pool.EC2BuildetPool().QuotaStats()) | ||
mergeStats(pool.NewGCEConfiguration().BuildletPool().QuotaStats()) | ||
if err := queuesTemplate.Execute(w, resp); err != nil { | ||
log.Printf("handleQueues: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2022 The Go Authors All rights reserved. | ||
Use of this source code is governed by a BSD-style | ||
license that can be found in the LICENSE file. | ||
--> | ||
|
||
<html lang="en"> | ||
<head> | ||
<link rel="stylesheet" href="/style.css" /> | ||
<title>Go Farmer Queues</title> | ||
</head> | ||
<body> | ||
{{template "build-header"}} | ||
<h2>Queues</h2> | ||
<div class="QueueStats"> | ||
{{range $name, $stats := .Queues}} | ||
<div class="QueueStats-queue"> | ||
<table class="QueueStats-queueTable"> | ||
<caption> | ||
<a href="#{{$name}}" id="{{$name}}"> | ||
{{$name}} | ||
</a> | ||
</caption> | ||
<thead> | ||
<tr> | ||
<th class="QueueStats-queueTableHeader">Name</th> | ||
<th class="QueueStats-queueTableHeader">Cost</th> | ||
<th class="QueueStats-queueTableHeader">Type/Priority</th> | ||
<th class="QueueStats-queueTableHeader">User</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range $item := $stats.Items}} | ||
<tr class="QueueStats-queueTableRow"> | ||
{{$build := $item.Build}} | ||
<td class="QueueStats-queueTableColumn"> | ||
{{$item.Build.HostType}} | ||
</td> | ||
<td class="QueueStats-queueTableColumn"> | ||
{{$item.Cost}} | ||
</td> | ||
<td class="QueueStats-queueTableColumn"> | ||
{{if $build.IsRelease}} | ||
Release | ||
{{else if $build.IsGomote}} | ||
Gomote | ||
{{else if $build.IsTry}} | ||
Trybot | ||
{{else}} | ||
Post-submit | ||
{{end}} | ||
/ | ||
{{$build.Priority}} | ||
</td> | ||
<td class="QueueStats-queueTableColumn"> | ||
{{$build.User}} | ||
</td> | ||
</tr> | ||
{{else}} | ||
<tr class="QueueStats-queueTableRow"> | ||
<td class="QueueStats-queueTableColumn" colspan="4"> | ||
Queue empty. | ||
</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
{{end}} | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters