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

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: Cleanup capture_archives 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 type PagesetVars struct {
dogben 2015/10/15 13:51:57 Nit: documentation.
rmistry 2015/10/15 14:21:56 Done.
243 UrlsList string `json:"urls_list"`
244 UserAgent string `json:"user_agent"`
245 ArchiveDataFile string `json:"archive_data_file"`
246 }
247
248 func ReadPageset(pagesetPath string) (PagesetVars, error) {
249 decodedPageset := PagesetVars{}
250 pagesetContent, err := os.Open(pagesetPath)
251 if err != nil {
252 return decodedPageset, fmt.Errorf("Could not read %s: %s", pages etPath, err)
253 }
254 if err := json.NewDecoder(pagesetContent).Decode(&decodedPageset); err ! = nil {
255 return decodedPageset, fmt.Errorf("Could not JSON decode %s: %s" , pagesetPath, err)
256 }
257 return decodedPageset, nil
258 }
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