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

Side by Side Diff: infra/bots/common.py

Issue 1754843002: Swarming bots: Add support for perf steps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 9 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 | « no previous file | infra/bots/perf_skia.isolate » ('j') | infra/bots/perf_skia.isolate » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2016 Google Inc. 3 # Copyright 2016 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 8
9 import contextlib 9 import contextlib
10 import math 10 import math
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 # TryBots are uploaded elsewhere so they can use the same key. 269 # TryBots are uploaded elsewhere so they can use the same key.
270 blacklist = ['role', 'is_trybot'] 270 blacklist = ['role', 'is_trybot']
271 271
272 flat = [] 272 flat = []
273 for k in sorted(self.bot_cfg.keys()): 273 for k in sorted(self.bot_cfg.keys()):
274 if k not in blacklist: 274 if k not in blacklist:
275 flat.append(k) 275 flat.append(k)
276 flat.append(self.bot_cfg[k]) 276 flat.append(self.bot_cfg[k])
277 return flat 277 return flat
278 278
279 def test_steps(self, got_revision, master_name, slave_name, build_number): 279 def test_steps(self, got_revision, master_name, slave_name, build_number,
280 issue=None, patchset=None):
280 """Run the DM test.""" 281 """Run the DM test."""
281 self.build_number = build_number 282 self.build_number = build_number
282 self.got_revision = got_revision 283 self.got_revision = got_revision
283 self.master_name = master_name 284 self.master_name = master_name
284 self.slave_name = slave_name 285 self.slave_name = slave_name
285 self._run_once(self.install) 286 self._run_once(self.install)
286 287
287 use_hash_file = False 288 use_hash_file = False
288 if self.upload_dm_results: 289 if self.upload_dm_results:
289 # This must run before we write anything into self.device_dirs.dm_dir 290 # This must run before we write anything into self.device_dirs.dm_dir
(...skipping 22 matching lines...) Expand all
312 use_hash_file = True 313 use_hash_file = True
313 314
314 # Run DM. 315 # Run DM.
315 properties = [ 316 properties = [
316 'gitHash', self.got_revision, 317 'gitHash', self.got_revision,
317 'master', self.master_name, 318 'master', self.master_name,
318 'builder', self.name, 319 'builder', self.name,
319 'build_number', self.build_number, 320 'build_number', self.build_number,
320 ] 321 ]
321 if self.is_trybot: 322 if self.is_trybot:
323 if not issue:
324 raise Exception('issue is required for trybots.')
325 if not patchset:
326 raise Exception('patchset is required for trybots.')
322 properties.extend([ 327 properties.extend([
323 'issue', self.m.properties['issue'], 328 'issue', issue,
324 'patchset', self.m.properties['patchset'], 329 'patchset', patchset,
325 ]) 330 ])
326 331
327 args = [ 332 args = [
328 'dm', 333 'dm',
329 '--undefok', # This helps branches that may not know new flags. 334 '--undefok', # This helps branches that may not know new flags.
330 '--verbose', 335 '--verbose',
331 '--resourcePath', self.device_dirs.resource_dir, 336 '--resourcePath', self.device_dirs.resource_dir,
332 '--skps', self.device_dirs.skp_dir, 337 '--skps', self.device_dirs.skp_dir,
333 '--images', self.flavor.device_path_join( 338 '--images', self.flavor.device_path_join(
334 self.device_dirs.images_dir, 'dm'), 339 self.device_dirs.images_dir, 'dm'),
(...skipping 19 matching lines...) Expand all
354 359
355 self.flavor.run(args, env=self.default_env) 360 self.flavor.run(args, env=self.default_env)
356 361
357 if self.upload_dm_results: 362 if self.upload_dm_results:
358 # Copy images and JSON to host machine if needed. 363 # Copy images and JSON to host machine if needed.
359 self.flavor.copy_directory_contents_to_host(self.device_dirs.dm_dir, 364 self.flavor.copy_directory_contents_to_host(self.device_dirs.dm_dir,
360 host_dm_dir) 365 host_dm_dir)
361 366
362 # See skia:2789. 367 # See skia:2789.
363 if ('Valgrind' in self.name and 368 if ('Valgrind' in self.name and
364 self.builder_cfg.get('cpu_or_gpu') == 'GPU'): 369 self.bot_cfg.get('cpu_or_gpu') == 'GPU'):
365 abandonGpuContext = list(args) 370 abandonGpuContext = list(args)
366 abandonGpuContext.append('--abandonGpuContext') 371 abandonGpuContext.append('--abandonGpuContext')
367 self.flavor.run(abandonGpuContext) 372 self.flavor.run(abandonGpuContext)
368 preAbandonGpuContext = list(args) 373 preAbandonGpuContext = list(args)
369 preAbandonGpuContext.append('--preAbandonGpuContext') 374 preAbandonGpuContext.append('--preAbandonGpuContext')
370 self.flavor.run(preAbandonGpuContext) 375 self.flavor.run(preAbandonGpuContext)
376
377 self.flavor.cleanup_steps()
378
379 def perf_steps(self, got_revision, master_name, slave_name, build_number,
380 issue=None, patchset=None):
381 """Run Skia benchmarks."""
382 self.build_number = build_number
383 self.got_revision = got_revision
384 self.master_name = master_name
385 self.slave_name = slave_name
386 self._run_once(self.install)
387 if self.upload_perf_results:
388 self.flavor.create_clean_device_dir(self.device_dirs.perf_data_dir)
389
390 # Run nanobench.
391 properties = [
392 '--properties',
393 'gitHash', self.got_revision,
394 'build_number', self.build_number,
395 ]
396 if self.is_trybot:
397 if not issue:
398 raise Exception('issue is required for trybots.')
399 if not patchset:
400 raise Exception('patchset is required for trybots.')
401 properties.extend([
402 'issue', issue,
403 'patchset', patchset,
404 ])
405
406 target = 'nanobench'
407 if 'VisualBench' in self.name:
408 target = 'visualbench'
409 args = [
410 target,
411 '--undefok', # This helps branches that may not know new flags.
412 '-i', self.device_dirs.resource_dir,
413 '--skps', self.device_dirs.skp_dir,
414 '--images', self.flavor.device_path_join(
415 self.device_dirs.images_dir, 'dm'), # Using DM images for now.
416 ]
417
418 skip_flag = None
419 if self.bot_cfg.get('cpu_or_gpu') == 'CPU':
420 skip_flag = '--nogpu'
421 elif self.bot_cfg.get('cpu_or_gpu') == 'GPU':
422 skip_flag = '--nocpu'
423 if skip_flag:
424 args.append(skip_flag)
425 args.extend(self.nanobench_flags)
426
427 if self.upload_perf_results:
428 json_path = self.flavor.device_path_join(
429 self.device_dirs.perf_data_dir,
430 'nanobench_%s.json' % self.got_revision)
431 args.extend(['--outResultsFile', json_path])
432 args.extend(properties)
433
434 keys_blacklist = ['configuration', 'role', 'is_trybot']
435 args.append('--key')
436 for k in sorted(self.bot_cfg.keys()):
437 if not k in keys_blacklist:
438 args.extend([k, self.bot_cfg[k]])
439
440 self.flavor.run(args, env=self.default_env)
441
442 # See skia:2789.
443 if ('Valgrind' in self.name and
444 self.bot_cfg.get('cpu_or_gpu') == 'GPU'):
445 abandonGpuContext = list(args)
446 abandonGpuContext.extend(['--abandonGpuContext', '--nocpu'])
447 self.flavor.run(abandonGpuContext, env=self.default_env)
448
449 # Copy results to host.
450 if self.upload_perf_results:
451 if not os.path.exists(self.perf_data_dir):
452 os.makedirs(self.perf_data_dir)
453 self.flavor.copy_directory_contents_to_host(
454 self.device_dirs.perf_data_dir, self.perf_data_dir)
455
456 self.flavor.cleanup_steps()
OLDNEW
« no previous file with comments | « no previous file | infra/bots/perf_skia.isolate » ('j') | infra/bots/perf_skia.isolate » ('J')

Powered by Google App Engine
This is Rietveld 408576698