Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ct/go/util/util.go

Issue 1392173005: [CT] Update worker scripts to use new benchmarks and delete old benchmarks (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ct/go/util/constants.go ('k') | ct/go/worker_scripts/capture_archives/main.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Utility that contains methods for both CT master and worker scripts. 1 // Utility that contains methods for both CT master and worker scripts.
2 package util 2 package util
3 3
4 import ( 4 import (
5 "bufio" 5 "bufio"
6 "encoding/json"
6 "fmt" 7 "fmt"
7 "io" 8 "io"
8 "io/ioutil" 9 "io/ioutil"
9 "os" 10 "os"
10 "path/filepath" 11 "path/filepath"
11 "strconv" 12 "strconv"
12 "sync" 13 "sync"
13 "time" 14 "time"
14 15
15 "go.skia.org/infra/go/exec" 16 "go.skia.org/infra/go/exec"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // happening chrome zombie processes are periodically killed. 231 // happening chrome zombie processes are periodically killed.
231 func ChromeProcessesCleaner(locker sync.Locker, chromeCleanerTimer time.Duration ) { 232 func ChromeProcessesCleaner(locker sync.Locker, chromeCleanerTimer time.Duration ) {
232 for _ = range time.Tick(chromeCleanerTimer) { 233 for _ = range time.Tick(chromeCleanerTimer) {
233 glog.Info("The chromeProcessesCleaner goroutine has started") 234 glog.Info("The chromeProcessesCleaner goroutine has started")
234 glog.Info("Waiting for all existing tasks to complete before kil ling zombie chrome processes") 235 glog.Info("Waiting for all existing tasks to complete before kil ling zombie chrome processes")
235 locker.Lock() 236 locker.Lock()
236 util.LogErr(ExecuteCmd("pkill", []string{"-9", "chrome"}, []stri ng{}, PKILL_TIMEOUT, nil, nil)) 237 util.LogErr(ExecuteCmd("pkill", []string{"-9", "chrome"}, []stri ng{}, PKILL_TIMEOUT, nil, nil))
237 locker.Unlock() 238 locker.Unlock()
238 } 239 }
239 } 240 }
241
242 // Contains the data included in CT pagesets.
243 type PagesetVars struct {
244 // A comma separated list of URLs.
245 UrlsList string `json:"urls_list"`
246 // Will be either "mobile" or "desktop".
247 UserAgent string `json:"user_agent"`
248 // The location of the web page's WPR data file.
249 ArchiveDataFile string `json:"archive_data_file"`
250 }
251
252 func ReadPageset(pagesetPath string) (PagesetVars, error) {
253 decodedPageset := PagesetVars{}
254 pagesetContent, err := os.Open(pagesetPath)
255 if err != nil {
256 return decodedPageset, fmt.Errorf("Could not read %s: %s", pages etPath, err)
257 }
258 if err := json.NewDecoder(pagesetContent).Decode(&decodedPageset); err ! = nil {
259 return decodedPageset, fmt.Errorf("Could not JSON decode %s: %s" , pagesetPath, err)
260 }
261 return decodedPageset, nil
262 }
OLDNEW
« no previous file with comments | « ct/go/util/constants.go ('k') | ct/go/worker_scripts/capture_archives/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698