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

Unified Diff: ct/go/util/util.go

Issue 1991043005: Add support for parallel runs (Closed) Base URL: https://skia.googlesource.com/buildbot@ct-8-chromium_analysis
Patch Set: Rebase 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
« no previous file with comments | « ct/go/util/constants.go ('k') | ct/go/worker_scripts/build_repo/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ct/go/util/util.go
diff --git a/ct/go/util/util.go b/ct/go/util/util.go
index e4291fbed729b83df942f967d0187b4538772688..34823d247e2b67b2b9ddc4511f3fb183321a8514 100644
--- a/ct/go/util/util.go
+++ b/ct/go/util/util.go
@@ -445,7 +445,7 @@ func TriggerSwarmingTask(pagesetType, taskPrefix, isolateName string, hardTimeou
return fmt.Errorf("len(genJSONs) was %d and len(tasksToHashes) was %d", len(genJSONs), len(tasksToHashes))
}
// Trigger swarming using the isolate hashes.
- dimensions := map[string]string{"pool": SWARMING_POOL}
+ dimensions := map[string]string{"pool": SWARMING_POOL, "cores": strconv.Itoa(2)}
tasks, err := s.TriggerSwarmingTasks(tasksToHashes, dimensions, swarming.RECOMMENDED_PRIORITY, swarming.RECOMMENDED_EXPIRATION, hardTimeout, ioTimeout, false)
if err != nil {
return fmt.Errorf("Could not trigger swarming task: %s", err)
@@ -684,3 +684,61 @@ func writeRowsToCSV(csvPath string, headers []string, values [][]string) error {
}
return nil
}
+
+func TriggerBuildRepoSwarmingTask(taskName, runID, repo, targetPlatform string, hashes, patches []string, singleBuild bool, hardTimeout, ioTimeout time.Duration) (string, error) {
+ // Instantiate the swarming client.
+ workDir, err := ioutil.TempDir("", "swarming_work_")
+ if err != nil {
+ return "", fmt.Errorf("Could not get temp dir: %s", err)
+ }
+ s, err := swarming.NewSwarmingClient(workDir)
+ if err != nil {
+ return "", fmt.Errorf("Could not instantiate swarming client: %s", err)
+ }
+ //defer s.Cleanup()
+ // Create isolated.gen.json.
+ // Get path to isolate files.
+ _, currentFile, _, _ := runtime.Caller(0)
+ pathToIsolates := filepath.Join(filepath.Dir(filepath.Dir(filepath.Dir(currentFile))), "isolates")
+ isolateArgs := map[string]string{
+ "RUN_ID": runID,
+ "REPO": repo,
+ "HASHES": strings.Join(hashes, ","),
+ "PATCHES": strings.Join(patches, ","),
+ "SINGLE_BUILD": strconv.FormatBool(singleBuild),
+ "TARGET_PLATFORM": targetPlatform,
+ }
+ genJSON, err := s.CreateIsolatedGenJSON(path.Join(pathToIsolates, BUILD_REPO_ISOLATE), s.WorkDir, "linux", taskName, isolateArgs, []string{})
+ if err != nil {
+ return "", fmt.Errorf("Could not create isolated.gen.json for task %s: %s", taskName, err)
+ }
+ // Batcharchive the task.
+ tasksToHashes, err := s.BatchArchiveTargets([]string{genJSON}, BATCHARCHIVE_TIMEOUT)
+ if err != nil {
+ return "", fmt.Errorf("Could not batch archive target: %s", err)
+ }
+ // Trigger swarming using the isolate hash.
+ dimensions := map[string]string{
+ "pool": SWARMING_POOL,
+ "cores": strconv.Itoa(32),
+ }
+ tasks, err := s.TriggerSwarmingTasks(tasksToHashes, dimensions, swarming.RECOMMENDED_PRIORITY, swarming.RECOMMENDED_EXPIRATION, hardTimeout, ioTimeout, false)
+ if err != nil {
+ return "", fmt.Errorf("Could not trigger swarming task: %s", err)
+ }
+ if len(tasks) != 1 {
+ return "", fmt.Errorf("Expected a single task instead got: %v", tasks)
+ }
+ // Collect all tasks and log the ones that fail.
+ task := tasks[0]
+ _, outputDir, err := task.Collect(s)
+ if err != nil {
+ return "", fmt.Errorf("task %s failed: %s", task.Title, err)
+ }
+ outputFile := filepath.Join(outputDir, BUILD_OUTPUT_FILENAME)
+ contents, err := ioutil.ReadFile(outputFile)
+ if err != nil {
+ return "", fmt.Errorf("Could not read outputfile %s: %s", outputFile, err)
+ }
+ return string(contents), nil
+}
« no previous file with comments | « ct/go/util/constants.go ('k') | ct/go/worker_scripts/build_repo/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698