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

Side by Side Diff: master/skia_master_scripts/factory.py

Issue 175523003: Raise Exception instead of failure when some steps fail. (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Retry Upload Created 6 years, 10 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
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 """Utility class to build the Skia master BuildFactory's. 6 """Utility class to build the Skia master BuildFactory's.
7 7
8 Based on gclient_factory.py and adds Skia-specific steps.""" 8 Based on gclient_factory.py and adds Skia-specific steps."""
9 9
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 # b. All of the printing can noticeably slow down the master startup 234 # b. All of the printing can noticeably slow down the master startup
235 # c. The master prints so much output that it would be easy to miss the 235 # c. The master prints so much output that it would be easy to miss the
236 # diff if we did print it. 236 # diff if we did print it.
237 print 'Warning: Factory configuration for %s does not match ' \ 237 print 'Warning: Factory configuration for %s does not match ' \
238 'expectation!' % self._builder_name 238 'expectation!' % self._builder_name
239 239
240 def AddSlaveScript(self, script, description, args=None, timeout=None, 240 def AddSlaveScript(self, script, description, args=None, timeout=None,
241 halt_on_failure=False, is_upload_step=False, 241 halt_on_failure=False, is_upload_step=False,
242 is_rebaseline_step=False, get_props_from_stdout=None, 242 is_rebaseline_step=False, get_props_from_stdout=None,
243 workdir=None, do_step_if=None, always_run=False, 243 workdir=None, do_step_if=None, always_run=False,
244 flunk_on_failure=True): 244 flunk_on_failure=True, exception_on_failure=False):
245 """ Add a BuildStep consisting of a python script. 245 """ Add a BuildStep consisting of a python script.
246 246
247 script: which slave-side python script to run. 247 script: which slave-side python script to run.
248 description: string briefly describing the BuildStep. 248 description: string briefly describing the BuildStep.
249 args: optional list of strings; arguments to pass to the script. 249 args: optional list of strings; arguments to pass to the script.
250 timeout: optional integer; maximum time for the BuildStep to complete. 250 timeout: optional integer; maximum time for the BuildStep to complete.
251 halt_on_failure: boolean indicating whether to continue the build if this 251 halt_on_failure: boolean indicating whether to continue the build if this
252 step fails. 252 step fails.
253 is_upload_step: boolean indicating whether this step should be skipped when 253 is_upload_step: boolean indicating whether this step should be skipped when
254 the buildbot is not performing uploads. 254 the buildbot is not performing uploads.
255 is_rebaseline_step: boolean indicating whether this step is required for 255 is_rebaseline_step: boolean indicating whether this step is required for
256 rebaseline-only builds. 256 rebaseline-only builds.
257 get_props_from_stdout: optional dictionary. Keys are strings indicating 257 get_props_from_stdout: optional dictionary. Keys are strings indicating
258 build properties to set based on the output of this step. Values are 258 build properties to set based on the output of this step. Values are
259 strings containing regular expressions for parsing the property from 259 strings containing regular expressions for parsing the property from
260 the output of the step. 260 the output of the step.
261 workdir: optional string indicating the working directory in which to run 261 workdir: optional string indicating the working directory in which to run
262 the script. If this is provided, then the script must be given relative 262 the script. If this is provided, then the script must be given relative
263 to this directory. 263 to this directory.
264 do_step_if: optional, function which determines whether or not to run the 264 do_step_if: optional, function which determines whether or not to run the
265 step. 265 step.
266 always_run: boolean indicating whether this step should run even if a 266 always_run: boolean indicating whether this step should run even if a
267 previous step which had halt_on_failure has failed. 267 previous step which had halt_on_failure has failed.
268 flunk_on_failure: boolean indicating whether the whole build fails if this 268 flunk_on_failure: boolean indicating whether the whole build fails if this
269 step fails. 269 step fails.
270 exception_on_failure: boolean indicating whether to raise an exception if
271 this step fails.
270 """ 272 """
271 arguments = list(self._common_args) 273 arguments = list(self._common_args)
272 if args: 274 if args:
273 arguments += args 275 arguments += args
274 self._skia_cmd_obj.AddSlaveScript( 276 self._skia_cmd_obj.AddSlaveScript(
275 script=script, 277 script=script,
276 args=arguments, 278 args=arguments,
277 description=description, 279 description=description,
278 timeout=timeout, 280 timeout=timeout,
279 halt_on_failure=halt_on_failure, 281 halt_on_failure=halt_on_failure,
280 is_upload_step=is_upload_step, 282 is_upload_step=is_upload_step,
281 is_rebaseline_step=is_rebaseline_step, 283 is_rebaseline_step=is_rebaseline_step,
282 get_props_from_stdout=get_props_from_stdout, 284 get_props_from_stdout=get_props_from_stdout,
283 workdir=workdir, 285 workdir=workdir,
284 do_step_if=do_step_if, 286 do_step_if=do_step_if,
285 always_run=always_run, 287 always_run=always_run,
286 flunk_on_failure=flunk_on_failure) 288 flunk_on_failure=flunk_on_failure,
289 exception_on_failure=exception_on_failure)
287 290
288 def AddFlavoredSlaveScript(self, script, args=None, **kwargs): 291 def AddFlavoredSlaveScript(self, script, args=None, **kwargs):
289 """ Add a flavor-specific BuildStep. 292 """ Add a flavor-specific BuildStep.
290 293
291 Finds a script to run by concatenating the flavor of this BuildFactory with 294 Finds a script to run by concatenating the flavor of this BuildFactory with
292 the provided script name. 295 the provided script name.
293 """ 296 """
294 flavor_args = ['--flavor', self._flavor or 'default'] 297 flavor_args = ['--flavor', self._flavor or 'default']
295 self.AddSlaveScript(script, args=list(args or []) + flavor_args, **kwargs) 298 self.AddSlaveScript(script, args=list(args or []) + flavor_args, **kwargs)
296 299
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 self.Make(target=build_target, 429 self.Make(target=build_target,
427 description=_COMPILE_NO_WERR_PREFIX + \ 430 description=_COMPILE_NO_WERR_PREFIX + \
428 utils.UnderscoresToCapWords(build_target), 431 utils.UnderscoresToCapWords(build_target),
429 flunk_on_failure=True, 432 flunk_on_failure=True,
430 halt_on_failure=True, 433 halt_on_failure=True,
431 do_step_if=ShouldRetryWithoutWarnings) 434 do_step_if=ShouldRetryWithoutWarnings)
432 435
433 def Install(self): 436 def Install(self):
434 """ Install the compiled executables. """ 437 """ Install the compiled executables. """
435 self.AddFlavoredSlaveScript(script='install.py', description='Install', 438 self.AddFlavoredSlaveScript(script='install.py', description='Install',
436 halt_on_failure=True) 439 halt_on_failure=True, exception_on_failure=True)
437 440
438 def DownloadSKPs(self): 441 def DownloadSKPs(self):
439 """ Download the SKPs. """ 442 """ Download the SKPs. """
440 self.AddSlaveScript(script='download_skps.py', description='DownloadSKPs', 443 self.AddSlaveScript(script='download_skps.py', description='DownloadSKPs',
441 halt_on_failure=True) 444 halt_on_failure=True, exception_on_failure=True)
442 445
443 def DownloadSKImageFiles(self): 446 def DownloadSKImageFiles(self):
444 """ Download image files for running skimage. """ 447 """ Download image files for running skimage. """
445 self.AddSlaveScript(script='download_skimage_files.py', 448 self.AddSlaveScript(script='download_skimage_files.py',
446 description='DownloadSKImageFiles', 449 description='DownloadSKImageFiles',
447 halt_on_failure=True) 450 halt_on_failure=True, exception_on_failure=True)
448 451
449 def DownloadBaselines(self): 452 def DownloadBaselines(self):
450 """ Download the GM baselines. """ 453 """ Download the GM baselines. """
451 self.AddSlaveScript(script='download_baselines.py', 454 self.AddSlaveScript(script='download_baselines.py',
452 description='DownloadBaselines', halt_on_failure=True) 455 description='DownloadBaselines', halt_on_failure=True,
456 exception_on_failure=True)
453 457
454 def RunTests(self): 458 def RunTests(self):
455 """ Run the unit tests. """ 459 """ Run the unit tests. """
456 self.AddFlavoredSlaveScript(script='run_tests.py', description='RunTests') 460 self.AddFlavoredSlaveScript(script='run_tests.py', description='RunTests')
457 461
458 def RunDecodingTests(self): 462 def RunDecodingTests(self):
459 """ Run tests of image decoders. """ 463 """ Run tests of image decoders. """
460 self.AddFlavoredSlaveScript(script='run_decoding_tests.py', 464 self.AddFlavoredSlaveScript(script='run_decoding_tests.py',
461 description='RunDecodingTests') 465 description='RunDecodingTests')
462 466
463 def RunGM(self): 467 def RunGM(self):
464 """ Run the "GM" tool, saving the images to disk. """ 468 """ Run the "GM" tool, saving the images to disk. """
465 self.AddFlavoredSlaveScript(script='run_gm.py', description='GenerateGMs', 469 self.AddFlavoredSlaveScript(script='run_gm.py', description='GenerateGMs',
466 is_rebaseline_step=True) 470 is_rebaseline_step=True)
467 471
468 def PreRender(self): 472 def PreRender(self):
469 """ Step to run before the render steps. """ 473 """ Step to run before the render steps. """
470 self.AddFlavoredSlaveScript(script='prerender.py', description='PreRender') 474 self.AddFlavoredSlaveScript(script='prerender.py', description='PreRender',
475 exception_on_failure=True)
471 476
472 def RenderPictures(self): 477 def RenderPictures(self):
473 """ Run the "render_pictures" tool to generate images from .skp's. """ 478 """ Run the "render_pictures" tool to generate images from .skp's. """
474 self.AddFlavoredSlaveScript(script='render_pictures.py', 479 self.AddFlavoredSlaveScript(script='render_pictures.py',
475 description='RenderPictures') 480 description='RenderPictures')
476 481
477 def RenderPdfs(self): 482 def RenderPdfs(self):
478 """ Run the "render_pdfs" tool to generate pdfs from .skp's. """ 483 """ Run the "render_pdfs" tool to generate pdfs from .skp's. """
479 self.AddFlavoredSlaveScript(script='render_pdfs.py', 484 self.AddFlavoredSlaveScript(script='render_pdfs.py',
480 description='RenderPdfs') 485 description='RenderPdfs')
481 486
482 def PostRender(self): 487 def PostRender(self):
483 """ Step to run after the render steps. """ 488 """ Step to run after the render steps. """
484 self.AddFlavoredSlaveScript(script='postrender.py', 489 self.AddFlavoredSlaveScript(script='postrender.py',
485 description='PostRender') 490 description='PostRender',
491 exception_on_failure=True)
486 492
487 def PreBench(self): 493 def PreBench(self):
488 """ Step to run before the benchmarking steps. """ 494 """ Step to run before the benchmarking steps. """
489 self.AddFlavoredSlaveScript(script='prebench.py', description='PreBench') 495 self.AddFlavoredSlaveScript(script='prebench.py',
496 description='PreBench',
497 exception_on_failure=True)
490 498
491 def PostBench(self): 499 def PostBench(self):
492 """ Step to run after the benchmarking steps. """ 500 """ Step to run after the benchmarking steps. """
493 self.AddFlavoredSlaveScript(script='postbench.py', description='PostBench') 501 self.AddFlavoredSlaveScript(script='postbench.py',
502 description='PostBench',
503 exception_on_failure=True)
494 504
495 def CompareGMs(self): 505 def CompareGMs(self):
496 """Compare the actually-generated GM images to the checked-in baselines.""" 506 """Compare the actually-generated GM images to the checked-in baselines."""
497 self.AddSlaveScript(script='compare_gms.py', description='CompareGMs', 507 self.AddSlaveScript(script='compare_gms.py',
508 description='CompareGMs',
498 is_rebaseline_step=True) 509 is_rebaseline_step=True)
499 510
500 def CompareAndUploadWebpageGMs(self): 511 def CompareAndUploadWebpageGMs(self):
501 """Compare the actually-generated images from render_pictures to their 512 """Compare the actually-generated images from render_pictures to their
502 expectations and upload the actual images if needed.""" 513 expectations and upload the actual images if needed."""
503 self.AddSlaveScript(script='compare_and_upload_webpage_gms.py', 514 self.AddSlaveScript(script='compare_and_upload_webpage_gms.py',
504 description='CompareAndUploadWebpageGMs', 515 description='CompareAndUploadWebpageGMs',
505 is_rebaseline_step=True) 516 is_rebaseline_step=True)
506 517
507 def RunBench(self): 518 def RunBench(self):
(...skipping 15 matching lines...) Expand all
523 """ Update the buildbot scripts on the build slave. """ 534 """ Update the buildbot scripts on the build slave. """
524 self.AddSlaveScript( 535 self.AddSlaveScript(
525 script=self.TargetPath.join('..', '..', '..', '..', 536 script=self.TargetPath.join('..', '..', '..', '..',
526 '..', 'slave', 537 '..', 'slave',
527 'skia_slave_scripts', 538 'skia_slave_scripts',
528 'update_scripts.py'), 539 'update_scripts.py'),
529 description='UpdateScripts', 540 description='UpdateScripts',
530 halt_on_failure=True, 541 halt_on_failure=True,
531 get_props_from_stdout={'buildbot_revision': 542 get_props_from_stdout={'buildbot_revision':
532 'Skiabot scripts updated to (\w+)'}, 543 'Skiabot scripts updated to (\w+)'},
533 workdir='build') 544 workdir='build',
545 exception_on_failure=True)
534 546
535 def Update(self): 547 def Update(self):
536 """ Update the Skia code on the build slave. """ 548 """ Update the Skia code on the build slave. """
537 args = ['--gclient_solutions', '"%s"' % self._gclient_solutions] 549 args = ['--gclient_solutions', '"%s"' % self._gclient_solutions]
538 self.AddSlaveScript( 550 self.AddSlaveScript(
539 script=self.TargetPath.join('..', '..', '..', '..', '..', 'slave', 551 script=self.TargetPath.join('..', '..', '..', '..', '..', 'slave',
540 'skia_slave_scripts', 'update.py'), 552 'skia_slave_scripts', 'update.py'),
541 description='Update', 553 description='Update',
542 args=args, 554 args=args,
543 timeout=None, 555 timeout=None,
544 halt_on_failure=True, 556 halt_on_failure=True,
545 is_upload_step=False, 557 is_upload_step=False,
546 is_rebaseline_step=True, 558 is_rebaseline_step=True,
547 get_props_from_stdout={'got_revision':'Skia updated to (\w+)'}, 559 get_props_from_stdout={'got_revision':'Skia updated to (\w+)'},
548 workdir='build') 560 workdir='build',
561 exception_on_failure=True)
549 562
550 def ApplyPatch(self, alternate_workdir=None, alternate_script=None): 563 def ApplyPatch(self, alternate_workdir=None, alternate_script=None):
551 """ Apply a patch to the Skia code on the build slave. """ 564 """ Apply a patch to the Skia code on the build slave. """
552 def _GetPatch(build): 565 def _GetPatch(build):
553 """Find information about the patch (if any) to apply. 566 """Find information about the patch (if any) to apply.
554 567
555 Returns: 568 Returns:
556 An encoded string containing a tuple of the form (level, url) which 569 An encoded string containing a tuple of the form (level, url) which
557 indicates where to go to download the patch. 570 indicates where to go to download the patch.
558 """ 571 """
(...skipping 20 matching lines...) Expand all
579 return str((1, patch)).encode() 592 return str((1, patch)).encode()
580 else: 593 else:
581 patch = 'None' 594 patch = 'None'
582 return patch 595 return patch
583 596
584 if not bool(alternate_workdir) == bool(alternate_script): 597 if not bool(alternate_workdir) == bool(alternate_script):
585 raise ValueError('alternate_workdir and alternate_script must be provided' 598 raise ValueError('alternate_workdir and alternate_script must be provided'
586 ' together.') 599 ' together.')
587 args = ['--patch', WithProperties('%(patch)s', patch=_GetPatch)] 600 args = ['--patch', WithProperties('%(patch)s', patch=_GetPatch)]
588 if alternate_script: 601 if alternate_script:
589 self.AddSlaveScript(script=alternate_script, description='ApplyPatch', 602 self.AddSlaveScript(script=alternate_script,
590 args=args, halt_on_failure=True, 603 description='ApplyPatch',
591 workdir=alternate_workdir) 604 args=args,
605 halt_on_failure=True,
606 workdir=alternate_workdir,
607 exception_on_failure=True)
592 else: 608 else:
593 self.AddSlaveScript(script='apply_patch.py', description='ApplyPatch', 609 self.AddSlaveScript(script='apply_patch.py',
594 args=args, halt_on_failure=True) 610 description='ApplyPatch',
611 args=args,
612 halt_on_failure=True,
613 exception_on_failure=True)
595 614
596 def UpdateSteps(self): 615 def UpdateSteps(self):
597 """ Update the Skia sources. """ 616 """ Update the Skia sources. """
598 self.UpdateScripts() 617 self.UpdateScripts()
599 self.Update() 618 self.Update()
600 if self._do_patch_step: 619 if self._do_patch_step:
601 self.ApplyPatch() 620 self.ApplyPatch()
602 621
603 def UploadBenchResults(self): 622 def UploadBenchResults(self):
604 """ Upload bench results (performance data). """ 623 """ Upload bench results (performance data). """
605 self.AddSlaveScript(script='upload_bench_results.py', 624 self.AddSlaveScript(script='upload_bench_results.py',
606 description='UploadBenchResults') 625 description='UploadBenchResults',
626 exception_on_failure=True)
607 627
608 def UploadBenchResultsToAppEngine(self): 628 def UploadBenchResultsToAppEngine(self):
609 """ Upload bench results (performance data) to AppEngine. """ 629 """ Upload bench results (performance data) to AppEngine. """
610 self.AddSlaveScript(script='upload_bench_results_appengine.py', 630 self.AddSlaveScript(script='upload_bench_results_appengine.py',
611 description='UploadBenchResultsToAppengine') 631 description='UploadBenchResultsToAppengine',
632 exception_on_failure=True)
612 633
613 def UploadWebpagePictureBenchResults(self): 634 def UploadWebpagePictureBenchResults(self):
614 """ Upload webpage picture bench results (performance data). """ 635 """ Upload webpage picture bench results (performance data). """
615 self.AddSlaveScript(script='upload_webpage_picture_bench_results.py', 636 self.AddSlaveScript(script='upload_webpage_picture_bench_results.py',
616 description='UploadWebpagePictureBenchResults') 637 description='UploadWebpagePictureBenchResults',
638 exception_on_failure=True)
617 639
618 640
619 def UploadGMResults(self): 641 def UploadGMResults(self):
620 """ Upload the images generated by GM """ 642 """ Upload the images generated by GM """
621 args = ['--autogen_svn_username_file', self._autogen_svn_username_file, 643 args = ['--autogen_svn_username_file', self._autogen_svn_username_file,
622 '--autogen_svn_password_file', self._autogen_svn_password_file] 644 '--autogen_svn_password_file', self._autogen_svn_password_file]
623 self.AddSlaveScript(script='upload_gm_results.py', args=args, 645 self.AddSlaveScript(script='upload_gm_results.py', args=args,
624 description='UploadGMResults', timeout=5400, 646 description='UploadGMResults', timeout=5400,
625 is_rebaseline_step=True) 647 is_rebaseline_step=True,
648 exception_on_failure=True)
626 649
627 def UploadSKImageResults(self): 650 def UploadSKImageResults(self):
628 self.AddSlaveScript(script='upload_skimage_results.py', 651 self.AddSlaveScript(script='upload_skimage_results.py',
629 description="UploadSKImageResults") 652 description='UploadSKImageResults',
653 exception_on_failure=True)
630 654
631 def CommonSteps(self, clobber=None): 655 def CommonSteps(self, clobber=None):
632 """ Steps which are run at the beginning of all builds. """ 656 """ Steps which are run at the beginning of all builds. """
633 self.UpdateSteps() 657 self.UpdateSteps()
634 self.DownloadSKPs() 658 self.DownloadSKPs()
635 self.Compile(clobber) 659 self.Compile(clobber)
636 self.Install() 660 self.Install()
637 661
638 def NonPerfSteps(self): 662 def NonPerfSteps(self):
639 """ Add correctness testing BuildSteps. """ 663 """ Add correctness testing BuildSteps. """
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 # Perf-only builder. 740 # Perf-only builder.
717 if not self._perf_output_basedir: 741 if not self._perf_output_basedir:
718 raise ValueError( 742 raise ValueError(
719 'BuildPerfOnly requires perf_output_basedir to be defined.') 743 'BuildPerfOnly requires perf_output_basedir to be defined.')
720 if self._configuration != CONFIG_RELEASE: 744 if self._configuration != CONFIG_RELEASE:
721 raise ValueError('BuildPerfOnly should run in %s configuration.' % 745 raise ValueError('BuildPerfOnly should run in %s configuration.' %
722 CONFIG_RELEASE) 746 CONFIG_RELEASE)
723 self.PerfSteps() 747 self.PerfSteps()
724 self.Validate() 748 self.Validate()
725 return self 749 return self
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698