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

Unified Diff: ct/go/worker_scripts/run_lua/main.go

Issue 1991943002: Use swarming in run_lua CT task (Closed) Base URL: https://skia.googlesource.com/buildbot@ct-6-capture_skps
Patch Set: Use new method in util.go Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ct/go/worker_scripts/run_lua/main.go
diff --git a/ct/go/worker_scripts/run_lua/main.go b/ct/go/worker_scripts/run_lua/main.go
index 945628b9b93839b6f3cbdb8df5ce5d728e5fe445..f33c6541232849496fa8f922307f6725662d62cb 100644
--- a/ct/go/worker_scripts/run_lua/main.go
+++ b/ct/go/worker_scripts/run_lua/main.go
@@ -3,10 +3,11 @@ package main
import (
"flag"
- "fmt"
"io"
"os"
+ "path"
"path/filepath"
+ "strconv"
"time"
"github.com/skia-dev/glog"
@@ -18,7 +19,8 @@ import (
)
var (
- workerNum = flag.Int("worker_num", 1, "The number of this CT worker. It will be in the {1..100} range.")
+ startRange = flag.Int("start_range", 1, "The number this worker will run lua scripts from.")
+ num = flag.Int("num", 100, "The total number of SKPs to run on starting from the start_range.")
pagesetType = flag.String("pageset_type", util.PAGESET_TYPE_MOBILE_10k, "The type of pagesets to create from the Alexa CSV list. Eg: 10k, Mobile10k, All.")
chromiumBuild = flag.String("chromium_build", "", "The chromium build that was used to create the SKPs we would like to run lua scripts against.")
runID = flag.String("run_id", "", "The unique run id (typically requester + timestamp).")
@@ -39,10 +41,6 @@ func main() {
return
}
- // Create the task file so that the master knows this worker is still busy.
- skutil.LogErr(util.CreateTaskFile(util.ACTIVITY_RUNNING_LUA_SCRIPTS))
- defer util.DeleteTaskFile(util.ACTIVITY_RUNNING_LUA_SCRIPTS)
-
// Sync Skia tree.
skutil.LogErr(util.SyncDir(util.SkiaTreeDir))
@@ -57,11 +55,12 @@ func main() {
}
// Download SKPs if they do not exist locally.
- if err := gs.DownloadWorkerArtifacts(util.SKPS_DIR_NAME, filepath.Join(*pagesetType, *chromiumBuild), *workerNum); err != nil {
+ localSkpsDir := filepath.Join(util.SkpsDir, *pagesetType, *chromiumBuild)
+ if _, err := gs.DownloadSwarmingArtifacts(localSkpsDir, util.SKPS_DIR_NAME, path.Join(*pagesetType, *chromiumBuild), *startRange, *num); err != nil {
glog.Error(err)
return
}
- localSkpsDir := filepath.Join(util.SkpsDir, *pagesetType, *chromiumBuild)
+ defer skutil.RemoveAll(localSkpsDir)
// Download the lua script for this run from Google storage.
luaScriptName := *runID + ".lua"
@@ -119,7 +118,7 @@ func main() {
// Copy stdout and stderr files to Google Storage.
skutil.LogErr(
- gs.UploadFile(stdoutFileName, os.TempDir(), filepath.Join(remoteDir, fmt.Sprintf("slave%d", *workerNum), "outputs")))
+ gs.UploadFile(stdoutFileName, os.TempDir(), filepath.Join(remoteDir, strconv.Itoa(*startRange), "outputs")))
skutil.LogErr(
- gs.UploadFile(stderrFileName, os.TempDir(), filepath.Join(remoteDir, fmt.Sprintf("slave%d", *workerNum), "errors")))
+ gs.UploadFile(stderrFileName, os.TempDir(), filepath.Join(remoteDir, strconv.Itoa(*startRange), "errors")))
}

Powered by Google App Engine
This is Rietveld 408576698