OLD | NEW |
1 // run_chromium_perf_on_workers is an application that runs the specified teleme
try | 1 // run_chromium_perf_on_workers is an application that runs the specified teleme
try |
2 // benchmark on all CT workers and uploads the results to Google Storage. The | 2 // benchmark on all CT workers and uploads the results to Google Storage. The |
3 // requester is emailed when the task is done. | 3 // requester is emailed when the task is done. |
4 package main | 4 package main |
5 | 5 |
6 import ( | 6 import ( |
7 "bytes" | 7 "bytes" |
8 "database/sql" | 8 "database/sql" |
9 "flag" | 9 "flag" |
10 "fmt" | 10 "fmt" |
(...skipping 29 matching lines...) Expand all Loading... |
40 targetPlatform = flag.String("target_platform", util.PLATFORM
_ANDROID, "The platform the benchmark will run on (Android / Linux).") | 40 targetPlatform = flag.String("target_platform", util.PLATFORM
_ANDROID, "The platform the benchmark will run on (Android / Linux).") |
41 runID = flag.String("run_id", "", "The unique run id
(typically requester + timestamp).") | 41 runID = flag.String("run_id", "", "The unique run id
(typically requester + timestamp).") |
42 varianceThreshold = flag.Float64("variance_threshold", 0.0, "The
variance threshold to use when comparing the resultant CSV files.") | 42 varianceThreshold = flag.Float64("variance_threshold", 0.0, "The
variance threshold to use when comparing the resultant CSV files.") |
43 discardOutliers = flag.Float64("discard_outliers", 0.0, "The p
ercentage of outliers to discard when comparing the result CSV files.") | 43 discardOutliers = flag.Float64("discard_outliers", 0.0, "The p
ercentage of outliers to discard when comparing the result CSV files.") |
44 | 44 |
45 taskCompletedSuccessfully = false | 45 taskCompletedSuccessfully = false |
46 | 46 |
47 htmlOutputLink = util.MASTER_LOGSERVER_LINK | 47 htmlOutputLink = util.MASTER_LOGSERVER_LINK |
48 skiaPatchLink = util.MASTER_LOGSERVER_LINK | 48 skiaPatchLink = util.MASTER_LOGSERVER_LINK |
49 chromiumPatchLink = util.MASTER_LOGSERVER_LINK | 49 chromiumPatchLink = util.MASTER_LOGSERVER_LINK |
| 50 benchmarkPatchLink = util.MASTER_LOGSERVER_LINK |
50 noPatchOutputLink = util.MASTER_LOGSERVER_LINK | 51 noPatchOutputLink = util.MASTER_LOGSERVER_LINK |
51 withPatchOutputLink = util.MASTER_LOGSERVER_LINK | 52 withPatchOutputLink = util.MASTER_LOGSERVER_LINK |
52 ) | 53 ) |
53 | 54 |
54 func sendEmail(recipients []string) { | 55 func sendEmail(recipients []string) { |
55 // Send completion email. | 56 // Send completion email. |
56 emailSubject := fmt.Sprintf("Cluster telemetry chromium perf task has co
mpleted (%s)", *runID) | 57 emailSubject := fmt.Sprintf("Cluster telemetry chromium perf task has co
mpleted (%s)", *runID) |
57 failureHtml := "" | 58 failureHtml := "" |
58 if !taskCompletedSuccessfully { | 59 if !taskCompletedSuccessfully { |
59 emailSubject += " with failures" | 60 emailSubject += " with failures" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 gs, err := util.NewGsUtil(nil) | 133 gs, err := util.NewGsUtil(nil) |
133 if err != nil { | 134 if err != nil { |
134 glog.Errorf("Could not instantiate gsutil object: %s", err) | 135 glog.Errorf("Could not instantiate gsutil object: %s", err) |
135 return | 136 return |
136 } | 137 } |
137 remoteOutputDir := filepath.Join(util.ChromiumPerfRunsDir, *runID) | 138 remoteOutputDir := filepath.Join(util.ChromiumPerfRunsDir, *runID) |
138 | 139 |
139 // Copy the patches to Google Storage. | 140 // Copy the patches to Google Storage. |
140 skiaPatchName := *runID + ".skia.patch" | 141 skiaPatchName := *runID + ".skia.patch" |
141 chromiumPatchName := *runID + ".chromium.patch" | 142 chromiumPatchName := *runID + ".chromium.patch" |
142 » for _, patchName := range []string{skiaPatchName, chromiumPatchName} { | 143 » benchmarkPatchName := *runID + ".benchmark.patch" |
| 144 » for _, patchName := range []string{skiaPatchName, chromiumPatchName, ben
chmarkPatchName} { |
143 if err := gs.UploadFile(patchName, os.TempDir(), remoteOutputDir
); err != nil { | 145 if err := gs.UploadFile(patchName, os.TempDir(), remoteOutputDir
); err != nil { |
144 glog.Errorf("Could not upload %s to %s: %s", patchName,
remoteOutputDir, err) | 146 glog.Errorf("Could not upload %s to %s: %s", patchName,
remoteOutputDir, err) |
145 return | 147 return |
146 } | 148 } |
147 } | 149 } |
148 skiaPatchLink = util.GS_HTTP_LINK + filepath.Join(util.GSBucketName, rem
oteOutputDir, skiaPatchName) | 150 skiaPatchLink = util.GS_HTTP_LINK + filepath.Join(util.GSBucketName, rem
oteOutputDir, skiaPatchName) |
149 chromiumPatchLink = util.GS_HTTP_LINK + filepath.Join(util.GSBucketName,
remoteOutputDir, chromiumPatchName) | 151 chromiumPatchLink = util.GS_HTTP_LINK + filepath.Join(util.GSBucketName,
remoteOutputDir, chromiumPatchName) |
| 152 benchmarkPatchLink = util.GS_HTTP_LINK + filepath.Join(util.GSBucketName
, remoteOutputDir, benchmarkPatchName) |
150 | 153 |
151 // Create the two required chromium builds (with patch and without the p
atch). | 154 // Create the two required chromium builds (with patch and without the p
atch). |
152 chromiumHash, skiaHash, err := util.CreateChromiumBuild(*runID, *targetP
latform, "", "", true) | 155 chromiumHash, skiaHash, err := util.CreateChromiumBuild(*runID, *targetP
latform, "", "", true) |
153 if err != nil { | 156 if err != nil { |
154 glog.Errorf("Could not create chromium build: %s", err) | 157 glog.Errorf("Could not create chromium build: %s", err) |
155 return | 158 return |
156 } | 159 } |
157 | 160 |
158 // Reboot all workers to start from a clean slate. | 161 // Reboot all workers to start from a clean slate. |
159 if !*master_common.Local { | 162 if !*master_common.Local { |
160 util.RebootWorkers() | 163 util.RebootWorkers() |
161 } | 164 } |
162 | 165 |
163 if *targetPlatform == util.PLATFORM_ANDROID { | 166 if *targetPlatform == util.PLATFORM_ANDROID { |
164 // Reboot all Android devices to start from a clean slate. | 167 // Reboot all Android devices to start from a clean slate. |
165 util.RebootAndroidDevices() | 168 util.RebootAndroidDevices() |
166 } | 169 } |
167 | 170 |
168 // Run the run_chromium_perf script on all workers. | 171 // Run the run_chromium_perf script on all workers. |
169 runIDNoPatch := *runID + "-nopatch" | 172 runIDNoPatch := *runID + "-nopatch" |
170 runIDWithPatch := *runID + "-withpatch" | 173 runIDWithPatch := *runID + "-withpatch" |
171 chromiumBuildNoPatch := fmt.Sprintf("try-%s-%s-%s", chromiumHash, skiaHa
sh, runIDNoPatch) | 174 chromiumBuildNoPatch := fmt.Sprintf("try-%s-%s-%s", chromiumHash, skiaHa
sh, runIDNoPatch) |
172 chromiumBuildWithPatch := fmt.Sprintf("try-%s-%s-%s", chromiumHash, skia
Hash, runIDWithPatch) | 175 chromiumBuildWithPatch := fmt.Sprintf("try-%s-%s-%s", chromiumHash, skia
Hash, runIDWithPatch) |
173 runChromiumPerfCmdTemplate := "DISPLAY=:0 run_chromium_perf " + | 176 runChromiumPerfCmdTemplate := "DISPLAY=:0 run_chromium_perf " + |
174 "--worker_num={{.WorkerNum}} --log_dir={{.LogDir}} --log_id={{.R
unID}} --pageset_type={{.PagesetType}} " + | 177 "--worker_num={{.WorkerNum}} --log_dir={{.LogDir}} --log_id={{.R
unID}} --pageset_type={{.PagesetType}} " + |
175 "--chromium_build_nopatch={{.ChromiumBuildNoPatch}} --chromium_b
uild_withpatch={{.ChromiumBuildWithPatch}} " + | 178 "--chromium_build_nopatch={{.ChromiumBuildNoPatch}} --chromium_b
uild_withpatch={{.ChromiumBuildWithPatch}} " + |
176 » » "--run_id_nopatch={{.RunIDNoPatch}} --run_id_withpatch={{.RunIDW
ithPatch}} " + | 179 » » "--run_id={{.RunID}} --run_id_nopatch={{.RunIDNoPatch}} --run_id
_withpatch={{.RunIDWithPatch}} " + |
177 "--benchmark_name={{.BenchmarkName}} --benchmark_extra_args=\"{{
.BenchmarkExtraArgs}}\" " + | 180 "--benchmark_name={{.BenchmarkName}} --benchmark_extra_args=\"{{
.BenchmarkExtraArgs}}\" " + |
178 "--browser_extra_args_nopatch=\"{{.BrowserExtraArgsNoPatch}}\" -
-browser_extra_args_withpatch=\"{{.BrowserExtraArgsWithPatch}}\" " + | 181 "--browser_extra_args_nopatch=\"{{.BrowserExtraArgsNoPatch}}\" -
-browser_extra_args_withpatch=\"{{.BrowserExtraArgsWithPatch}}\" " + |
179 "--repeat_benchmark={{.RepeatBenchmark}} --run_in_parallel={{.Ru
nInParallel}} --target_platform={{.TargetPlatform}} " + | 182 "--repeat_benchmark={{.RepeatBenchmark}} --run_in_parallel={{.Ru
nInParallel}} --target_platform={{.TargetPlatform}} " + |
180 "--local={{.Local}};" | 183 "--local={{.Local}};" |
181 runChromiumPerfTemplateParsed := template.Must(template.New("run_chromiu
m_perf_cmd").Parse(runChromiumPerfCmdTemplate)) | 184 runChromiumPerfTemplateParsed := template.Must(template.New("run_chromiu
m_perf_cmd").Parse(runChromiumPerfCmdTemplate)) |
182 runChromiumPerfCmdBytes := new(bytes.Buffer) | 185 runChromiumPerfCmdBytes := new(bytes.Buffer) |
183 if err := runChromiumPerfTemplateParsed.Execute(runChromiumPerfCmdBytes,
struct { | 186 if err := runChromiumPerfTemplateParsed.Execute(runChromiumPerfCmdBytes,
struct { |
184 WorkerNum string | 187 WorkerNum string |
185 LogDir string | 188 LogDir string |
186 PagesetType string | 189 PagesetType string |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 pathToCsvComparer, | 260 pathToCsvComparer, |
258 "--csv_file1=" + noPatchCSVPath, | 261 "--csv_file1=" + noPatchCSVPath, |
259 "--csv_file2=" + withPatchCSVPath, | 262 "--csv_file2=" + withPatchCSVPath, |
260 "--output_html=" + htmlOutputDir, | 263 "--output_html=" + htmlOutputDir, |
261 "--variance_threshold=" + strconv.FormatFloat(*varianceThreshold
, 'f', 2, 64), | 264 "--variance_threshold=" + strconv.FormatFloat(*varianceThreshold
, 'f', 2, 64), |
262 "--discard_outliers=" + strconv.FormatFloat(*discardOutliers, 'f
', 2, 64), | 265 "--discard_outliers=" + strconv.FormatFloat(*discardOutliers, 'f
', 2, 64), |
263 "--absolute_url=" + htmlOutputLinkBase, | 266 "--absolute_url=" + htmlOutputLinkBase, |
264 "--requester_email=" + *emails, | 267 "--requester_email=" + *emails, |
265 "--skia_patch_link=" + skiaPatchLink, | 268 "--skia_patch_link=" + skiaPatchLink, |
266 "--chromium_patch_link=" + chromiumPatchLink, | 269 "--chromium_patch_link=" + chromiumPatchLink, |
| 270 "--benchmark_patch_link=" + benchmarkPatchLink, |
267 "--description=" + *description, | 271 "--description=" + *description, |
268 "--raw_csv_nopatch=" + noPatchOutputLink, | 272 "--raw_csv_nopatch=" + noPatchOutputLink, |
269 "--raw_csv_withpatch=" + withPatchOutputLink, | 273 "--raw_csv_withpatch=" + withPatchOutputLink, |
270 "--num_repeated=" + strconv.Itoa(*repeatBenchmark), | 274 "--num_repeated=" + strconv.Itoa(*repeatBenchmark), |
271 "--target_platform=" + *targetPlatform, | 275 "--target_platform=" + *targetPlatform, |
272 "--browser_args_nopatch=" + *browserExtraArgsNoPatch, | 276 "--browser_args_nopatch=" + *browserExtraArgsNoPatch, |
273 "--browser_args_withpatch=" + *browserExtraArgsWithPatch, | 277 "--browser_args_withpatch=" + *browserExtraArgsWithPatch, |
274 "--pageset_type=" + *pagesetType, | 278 "--pageset_type=" + *pagesetType, |
275 "--chromium_hash=" + chromiumHash, | 279 "--chromium_hash=" + chromiumHash, |
276 "--skia_hash=" + skiaHash, | 280 "--skia_hash=" + skiaHash, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 if err != nil { | 338 if err != nil { |
335 return noOutputSlaves, fmt.Errorf("Error running csv_merger.py:
%s", err) | 339 return noOutputSlaves, fmt.Errorf("Error running csv_merger.py:
%s", err) |
336 } | 340 } |
337 // Copy the output file to Google Storage. | 341 // Copy the output file to Google Storage. |
338 remoteOutputDir := filepath.Join(util.BenchmarkRunsDir, runID, "consolid
ated_outputs") | 342 remoteOutputDir := filepath.Join(util.BenchmarkRunsDir, runID, "consolid
ated_outputs") |
339 if err := gs.UploadFile(outputFileName, localOutputDir, remoteOutputDir)
; err != nil { | 343 if err := gs.UploadFile(outputFileName, localOutputDir, remoteOutputDir)
; err != nil { |
340 return noOutputSlaves, fmt.Errorf("Unable to upload %s to %s: %s
", outputFileName, remoteOutputDir, err) | 344 return noOutputSlaves, fmt.Errorf("Unable to upload %s to %s: %s
", outputFileName, remoteOutputDir, err) |
341 } | 345 } |
342 return noOutputSlaves, nil | 346 return noOutputSlaves, nil |
343 } | 347 } |
OLD | NEW |