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

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: Include ALL the factory config files Created 6 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 | « master/skia_master_scripts/commands.py ('k') | master/skia_master_scripts/skia_build_step.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. This causes the step to go purple instead of red, and
272 causes the build to stop. Should be used if the build step's failure is
273 typically transient or results from an infrastructure failure rather
274 than a code change.
270 """ 275 """
271 arguments = list(self._common_args) 276 arguments = list(self._common_args)
272 if args: 277 if args:
273 arguments += args 278 arguments += args
274 self._skia_cmd_obj.AddSlaveScript( 279 self._skia_cmd_obj.AddSlaveScript(
275 script=script, 280 script=script,
276 args=arguments, 281 args=arguments,
277 description=description, 282 description=description,
278 timeout=timeout, 283 timeout=timeout,
279 halt_on_failure=halt_on_failure, 284 halt_on_failure=halt_on_failure,
280 is_upload_step=is_upload_step, 285 is_upload_step=is_upload_step,
281 is_rebaseline_step=is_rebaseline_step, 286 is_rebaseline_step=is_rebaseline_step,
282 get_props_from_stdout=get_props_from_stdout, 287 get_props_from_stdout=get_props_from_stdout,
283 workdir=workdir, 288 workdir=workdir,
284 do_step_if=do_step_if, 289 do_step_if=do_step_if,
285 always_run=always_run, 290 always_run=always_run,
286 flunk_on_failure=flunk_on_failure) 291 flunk_on_failure=flunk_on_failure,
292 exception_on_failure=exception_on_failure)
287 293
288 def AddFlavoredSlaveScript(self, script, args=None, **kwargs): 294 def AddFlavoredSlaveScript(self, script, args=None, **kwargs):
289 """ Add a flavor-specific BuildStep. 295 """ Add a flavor-specific BuildStep.
290 296
291 Finds a script to run by concatenating the flavor of this BuildFactory with 297 Finds a script to run by concatenating the flavor of this BuildFactory with
292 the provided script name. 298 the provided script name.
293 """ 299 """
294 flavor_args = ['--flavor', self._flavor or 'default'] 300 flavor_args = ['--flavor', self._flavor or 'default']
295 self.AddSlaveScript(script, args=list(args or []) + flavor_args, **kwargs) 301 self.AddSlaveScript(script, args=list(args or []) + flavor_args, **kwargs)
296 302
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 self.Make(target=build_target, 432 self.Make(target=build_target,
427 description=_COMPILE_NO_WERR_PREFIX + \ 433 description=_COMPILE_NO_WERR_PREFIX + \
428 utils.UnderscoresToCapWords(build_target), 434 utils.UnderscoresToCapWords(build_target),
429 flunk_on_failure=True, 435 flunk_on_failure=True,
430 halt_on_failure=True, 436 halt_on_failure=True,
431 do_step_if=ShouldRetryWithoutWarnings) 437 do_step_if=ShouldRetryWithoutWarnings)
432 438
433 def Install(self): 439 def Install(self):
434 """ Install the compiled executables. """ 440 """ Install the compiled executables. """
435 self.AddFlavoredSlaveScript(script='install.py', description='Install', 441 self.AddFlavoredSlaveScript(script='install.py', description='Install',
436 halt_on_failure=True) 442 halt_on_failure=True, exception_on_failure=True)
437 443
438 def DownloadSKPs(self): 444 def DownloadSKPs(self):
439 """ Download the SKPs. """ 445 """ Download the SKPs. """
440 self.AddSlaveScript(script='download_skps.py', description='DownloadSKPs', 446 self.AddSlaveScript(script='download_skps.py', description='DownloadSKPs',
441 halt_on_failure=True) 447 halt_on_failure=True, exception_on_failure=True)
442 448
443 def DownloadSKImageFiles(self): 449 def DownloadSKImageFiles(self):
444 """ Download image files for running skimage. """ 450 """ Download image files for running skimage. """
445 self.AddSlaveScript(script='download_skimage_files.py', 451 self.AddSlaveScript(script='download_skimage_files.py',
446 description='DownloadSKImageFiles', 452 description='DownloadSKImageFiles',
447 halt_on_failure=True) 453 halt_on_failure=True, exception_on_failure=True)
448 454
449 def DownloadBaselines(self): 455 def DownloadBaselines(self):
450 """ Download the GM baselines. """ 456 """ Download the GM baselines. """
451 self.AddSlaveScript(script='download_baselines.py', 457 self.AddSlaveScript(script='download_baselines.py',
452 description='DownloadBaselines', halt_on_failure=True) 458 description='DownloadBaselines', halt_on_failure=True,
459 exception_on_failure=True)
453 460
454 def RunTests(self): 461 def RunTests(self):
455 """ Run the unit tests. """ 462 """ Run the unit tests. """
456 self.AddFlavoredSlaveScript(script='run_tests.py', description='RunTests') 463 self.AddFlavoredSlaveScript(script='run_tests.py', description='RunTests')
457 464
458 def RunDecodingTests(self): 465 def RunDecodingTests(self):
459 """ Run tests of image decoders. """ 466 """ Run tests of image decoders. """
460 self.AddFlavoredSlaveScript(script='run_decoding_tests.py', 467 self.AddFlavoredSlaveScript(script='run_decoding_tests.py',
461 description='RunDecodingTests') 468 description='RunDecodingTests')
462 469
463 def RunGM(self): 470 def RunGM(self):
464 """ Run the "GM" tool, saving the images to disk. """ 471 """ Run the "GM" tool, saving the images to disk. """
465 self.AddFlavoredSlaveScript(script='run_gm.py', description='GenerateGMs', 472 self.AddFlavoredSlaveScript(script='run_gm.py', description='GenerateGMs',
466 is_rebaseline_step=True) 473 is_rebaseline_step=True)
467 474
468 def PreRender(self): 475 def PreRender(self):
469 """ Step to run before the render steps. """ 476 """ Step to run before the render steps. """
470 self.AddFlavoredSlaveScript(script='prerender.py', description='PreRender') 477 self.AddFlavoredSlaveScript(script='prerender.py', description='PreRender',
478 exception_on_failure=True)
471 479
472 def RenderPictures(self): 480 def RenderPictures(self):
473 """ Run the "render_pictures" tool to generate images from .skp's. """ 481 """ Run the "render_pictures" tool to generate images from .skp's. """
474 self.AddFlavoredSlaveScript(script='render_pictures.py', 482 self.AddFlavoredSlaveScript(script='render_pictures.py',
475 description='RenderPictures') 483 description='RenderPictures')
476 484
477 def RenderPdfs(self): 485 def RenderPdfs(self):
478 """ Run the "render_pdfs" tool to generate pdfs from .skp's. """ 486 """ Run the "render_pdfs" tool to generate pdfs from .skp's. """
479 self.AddFlavoredSlaveScript(script='render_pdfs.py', 487 self.AddFlavoredSlaveScript(script='render_pdfs.py',
480 description='RenderPdfs') 488 description='RenderPdfs')
481 489
482 def PostRender(self): 490 def PostRender(self):
483 """ Step to run after the render steps. """ 491 """ Step to run after the render steps. """
484 self.AddFlavoredSlaveScript(script='postrender.py', 492 self.AddFlavoredSlaveScript(script='postrender.py',
485 description='PostRender') 493 description='PostRender',
494 exception_on_failure=True)
486 495
487 def PreBench(self): 496 def PreBench(self):
488 """ Step to run before the benchmarking steps. """ 497 """ Step to run before the benchmarking steps. """
489 self.AddFlavoredSlaveScript(script='prebench.py', description='PreBench') 498 self.AddFlavoredSlaveScript(script='prebench.py',
499 description='PreBench',
500 exception_on_failure=True)
490 501
491 def PostBench(self): 502 def PostBench(self):
492 """ Step to run after the benchmarking steps. """ 503 """ Step to run after the benchmarking steps. """
493 self.AddFlavoredSlaveScript(script='postbench.py', description='PostBench') 504 self.AddFlavoredSlaveScript(script='postbench.py',
505 description='PostBench',
506 exception_on_failure=True)
494 507
495 def CompareGMs(self): 508 def CompareGMs(self):
496 """Compare the actually-generated GM images to the checked-in baselines.""" 509 """Compare the actually-generated GM images to the checked-in baselines."""
497 self.AddSlaveScript(script='compare_gms.py', description='CompareGMs', 510 self.AddSlaveScript(script='compare_gms.py',
511 description='CompareGMs',
498 is_rebaseline_step=True) 512 is_rebaseline_step=True)
499 513
500 def CompareAndUploadWebpageGMs(self): 514 def CompareAndUploadWebpageGMs(self):
501 """Compare the actually-generated images from render_pictures to their 515 """Compare the actually-generated images from render_pictures to their
502 expectations and upload the actual images if needed.""" 516 expectations and upload the actual images if needed."""
503 self.AddSlaveScript(script='compare_and_upload_webpage_gms.py', 517 self.AddSlaveScript(script='compare_and_upload_webpage_gms.py',
504 description='CompareAndUploadWebpageGMs', 518 description='CompareAndUploadWebpageGMs',
505 is_rebaseline_step=True) 519 is_rebaseline_step=True)
506 520
507 def RunBench(self): 521 def RunBench(self):
(...skipping 15 matching lines...) Expand all
523 """ Update the buildbot scripts on the build slave. """ 537 """ Update the buildbot scripts on the build slave. """
524 self.AddSlaveScript( 538 self.AddSlaveScript(
525 script=self.TargetPath.join('..', '..', '..', '..', 539 script=self.TargetPath.join('..', '..', '..', '..',
526 '..', 'slave', 540 '..', 'slave',
527 'skia_slave_scripts', 541 'skia_slave_scripts',
528 'update_scripts.py'), 542 'update_scripts.py'),
529 description='UpdateScripts', 543 description='UpdateScripts',
530 halt_on_failure=True, 544 halt_on_failure=True,
531 get_props_from_stdout={'buildbot_revision': 545 get_props_from_stdout={'buildbot_revision':
532 'Skiabot scripts updated to (\w+)'}, 546 'Skiabot scripts updated to (\w+)'},
533 workdir='build') 547 workdir='build',
548 exception_on_failure=True)
534 549
535 def Update(self): 550 def Update(self):
536 """ Update the Skia code on the build slave. """ 551 """ Update the Skia code on the build slave. """
537 args = ['--gclient_solutions', '"%s"' % self._gclient_solutions] 552 args = ['--gclient_solutions', '"%s"' % self._gclient_solutions]
538 self.AddSlaveScript( 553 self.AddSlaveScript(
539 script=self.TargetPath.join('..', '..', '..', '..', '..', 'slave', 554 script=self.TargetPath.join('..', '..', '..', '..', '..', 'slave',
540 'skia_slave_scripts', 'update.py'), 555 'skia_slave_scripts', 'update.py'),
541 description='Update', 556 description='Update',
542 args=args, 557 args=args,
543 timeout=None, 558 timeout=None,
544 halt_on_failure=True, 559 halt_on_failure=True,
545 is_upload_step=False, 560 is_upload_step=False,
546 is_rebaseline_step=True, 561 is_rebaseline_step=True,
547 get_props_from_stdout={'got_revision':'Skia updated to (\w+)'}, 562 get_props_from_stdout={'got_revision':'Skia updated to (\w+)'},
548 workdir='build') 563 workdir='build',
564 exception_on_failure=True)
549 565
550 def ApplyPatch(self, alternate_workdir=None, alternate_script=None): 566 def ApplyPatch(self, alternate_workdir=None, alternate_script=None):
551 """ Apply a patch to the Skia code on the build slave. """ 567 """ Apply a patch to the Skia code on the build slave. """
552 def _GetPatch(build): 568 def _GetPatch(build):
553 """Find information about the patch (if any) to apply. 569 """Find information about the patch (if any) to apply.
554 570
555 Returns: 571 Returns:
556 An encoded string containing a tuple of the form (level, url) which 572 An encoded string containing a tuple of the form (level, url) which
557 indicates where to go to download the patch. 573 indicates where to go to download the patch.
558 """ 574 """
(...skipping 20 matching lines...) Expand all
579 return str((1, patch)).encode() 595 return str((1, patch)).encode()
580 else: 596 else:
581 patch = 'None' 597 patch = 'None'
582 return patch 598 return patch
583 599
584 if not bool(alternate_workdir) == bool(alternate_script): 600 if not bool(alternate_workdir) == bool(alternate_script):
585 raise ValueError('alternate_workdir and alternate_script must be provided' 601 raise ValueError('alternate_workdir and alternate_script must be provided'
586 ' together.') 602 ' together.')
587 args = ['--patch', WithProperties('%(patch)s', patch=_GetPatch)] 603 args = ['--patch', WithProperties('%(patch)s', patch=_GetPatch)]
588 if alternate_script: 604 if alternate_script:
589 self.AddSlaveScript(script=alternate_script, description='ApplyPatch', 605 self.AddSlaveScript(script=alternate_script,
590 args=args, halt_on_failure=True, 606 description='ApplyPatch',
591 workdir=alternate_workdir) 607 args=args,
608 halt_on_failure=True,
609 workdir=alternate_workdir,
610 exception_on_failure=True)
592 else: 611 else:
593 self.AddSlaveScript(script='apply_patch.py', description='ApplyPatch', 612 self.AddSlaveScript(script='apply_patch.py',
594 args=args, halt_on_failure=True) 613 description='ApplyPatch',
614 args=args,
615 halt_on_failure=True,
616 exception_on_failure=True)
595 617
596 def UpdateSteps(self): 618 def UpdateSteps(self):
597 """ Update the Skia sources. """ 619 """ Update the Skia sources. """
598 self.UpdateScripts() 620 self.UpdateScripts()
599 self.Update() 621 self.Update()
600 if self._do_patch_step: 622 if self._do_patch_step:
601 self.ApplyPatch() 623 self.ApplyPatch()
602 624
603 def UploadBenchResults(self): 625 def UploadBenchResults(self):
604 """ Upload bench results (performance data). """ 626 """ Upload bench results (performance data). """
605 self.AddSlaveScript(script='upload_bench_results.py', 627 self.AddSlaveScript(script='upload_bench_results.py',
606 description='UploadBenchResults') 628 description='UploadBenchResults',
629 exception_on_failure=True)
607 630
608 def UploadBenchResultsToAppEngine(self): 631 def UploadBenchResultsToAppEngine(self):
609 """ Upload bench results (performance data) to AppEngine. """ 632 """ Upload bench results (performance data) to AppEngine. """
610 self.AddSlaveScript(script='upload_bench_results_appengine.py', 633 self.AddSlaveScript(script='upload_bench_results_appengine.py',
611 description='UploadBenchResultsToAppengine') 634 description='UploadBenchResultsToAppengine',
635 exception_on_failure=True)
612 636
613 def UploadWebpagePictureBenchResults(self): 637 def UploadWebpagePictureBenchResults(self):
614 """ Upload webpage picture bench results (performance data). """ 638 """ Upload webpage picture bench results (performance data). """
615 self.AddSlaveScript(script='upload_webpage_picture_bench_results.py', 639 self.AddSlaveScript(script='upload_webpage_picture_bench_results.py',
616 description='UploadWebpagePictureBenchResults') 640 description='UploadWebpagePictureBenchResults',
641 exception_on_failure=True)
617 642
618 643
619 def UploadGMResults(self): 644 def UploadGMResults(self):
620 """ Upload the images generated by GM """ 645 """ Upload the images generated by GM """
621 args = ['--autogen_svn_username_file', self._autogen_svn_username_file, 646 args = ['--autogen_svn_username_file', self._autogen_svn_username_file,
622 '--autogen_svn_password_file', self._autogen_svn_password_file] 647 '--autogen_svn_password_file', self._autogen_svn_password_file]
623 self.AddSlaveScript(script='upload_gm_results.py', args=args, 648 self.AddSlaveScript(script='upload_gm_results.py', args=args,
624 description='UploadGMResults', timeout=5400, 649 description='UploadGMResults', timeout=5400,
625 is_rebaseline_step=True) 650 is_rebaseline_step=True,
651 exception_on_failure=True)
626 652
627 def UploadSKImageResults(self): 653 def UploadSKImageResults(self):
628 self.AddSlaveScript(script='upload_skimage_results.py', 654 self.AddSlaveScript(script='upload_skimage_results.py',
629 description="UploadSKImageResults") 655 description='UploadSKImageResults',
656 exception_on_failure=True)
630 657
631 def CommonSteps(self, clobber=None): 658 def CommonSteps(self, clobber=None):
632 """ Steps which are run at the beginning of all builds. """ 659 """ Steps which are run at the beginning of all builds. """
633 self.UpdateSteps() 660 self.UpdateSteps()
634 self.DownloadSKPs() 661 self.DownloadSKPs()
635 self.Compile(clobber) 662 self.Compile(clobber)
636 self.Install() 663 self.Install()
637 664
638 def NonPerfSteps(self): 665 def NonPerfSteps(self):
639 """ Add correctness testing BuildSteps. """ 666 """ Add correctness testing BuildSteps. """
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 # Perf-only builder. 744 # Perf-only builder.
718 if not self._perf_output_basedir: 745 if not self._perf_output_basedir:
719 raise ValueError( 746 raise ValueError(
720 'BuildPerfOnly requires perf_output_basedir to be defined.') 747 'BuildPerfOnly requires perf_output_basedir to be defined.')
721 if self._configuration != CONFIG_RELEASE: 748 if self._configuration != CONFIG_RELEASE:
722 raise ValueError('BuildPerfOnly should run in %s configuration.' % 749 raise ValueError('BuildPerfOnly should run in %s configuration.' %
723 CONFIG_RELEASE) 750 CONFIG_RELEASE)
724 self.PerfSteps() 751 self.PerfSteps()
725 self.Validate() 752 self.Validate()
726 return self 753 return self
OLDNEW
« no previous file with comments | « master/skia_master_scripts/commands.py ('k') | master/skia_master_scripts/skia_build_step.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698