OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 """Sends patches to the Try server and reads back results. | 5 """Sends patches to the Try server and reads back results. |
6 | 6 |
7 - RietveldTryJobs contains RietveldTryJob, one per try job on a builder. | 7 - RietveldTryJobs contains RietveldTryJob, one per try job on a builder. |
8 - TryRunnerRietveld uses Rietveld to signal and poll job results. | 8 - TryRunnerRietveld uses Rietveld to signal and poll job results. |
9 """ | 9 """ |
10 | 10 |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 pending, now) | 660 pending, now) |
661 | 661 |
662 @model.immutable | 662 @model.immutable |
663 def _build_status_url(self, job): | 663 def _build_status_url(self, job): |
664 """Html url for this try job.""" | 664 """Html url for this try job.""" |
665 assert job.build is not None, str(job) | 665 assert job.build is not None, str(job) |
666 return '%s/buildstatus?builder=%s&number=%s' % ( | 666 return '%s/buildstatus?builder=%s&number=%s' % ( |
667 self.try_server_url, job.builder, job.build) | 667 self.try_server_url, job.builder, job.build) |
668 | 668 |
669 @model.immutable | 669 @model.immutable |
670 def _update_dashboard(self, pending, job, status): | 670 def _update_dashboard(self, pending, job): |
671 """Updates the CQ dashboard with the current Try Job state as known to the | 671 """Updates the CQ dashboard with the current Try Job state as known to the |
672 CQ. | 672 CQ. |
673 """ | 673 """ |
674 logging.debug('_update_dashboard(%s/%s)', job.builder, job.build) | 674 logging.debug('_update_dashboard(%s/%s)', job.builder, job.build) |
675 build = status.builders[job.builder].builds[job.build] | |
676 info = { | 675 info = { |
677 'build': job.build, | 676 'build': job.build, |
678 'builder': job.builder, | 677 'builder': job.builder, |
679 'duration': build.duration, | |
680 'job_name': 'CQ', | 678 'job_name': 'CQ', |
681 'result': job.result, | 679 'result': job.result, |
682 'revision': job.revision, | 680 'revision': job.revision, |
683 'url': self._build_status_url(job), | 681 'url': self._build_status_url(job), |
684 } | 682 } |
685 self.send_status(pending, info) | 683 self.send_status(pending, info) |
686 | 684 |
687 def _update_jobs_from_rietveld(self, pending, jobs, handle, now): | 685 def _update_jobs_from_rietveld(self, pending, jobs, handle, now): |
688 """Grabs data from Rietveld and pass it to | 686 """Grabs data from Rietveld and pass it to |
689 RietveldTryJobs.update_jobs_from_rietveld(). | 687 RietveldTryJobs.update_jobs_from_rietveld(). |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 # Temporary AppEngine hiccup. Just log it and return failure. | 733 # Temporary AppEngine hiccup. Just log it and return failure. |
736 if e.errno == 'socket error': | 734 if e.errno == 'socket error': |
737 logging.warning( | 735 logging.warning( |
738 '%s while updating tryserver status for rietveld issue %s.' % ( | 736 '%s while updating tryserver status for rietveld issue %s.' % ( |
739 str(e), str(pending.issue))) | 737 str(e), str(pending.issue))) |
740 return False | 738 return False |
741 raise | 739 raise |
742 if handle: | 740 if handle: |
743 for updated_key in keys: | 741 for updated_key in keys: |
744 job = jobs.try_jobs[updated_key] | 742 job = jobs.try_jobs[updated_key] |
745 self._update_dashboard(pending, job, status) | 743 self._update_dashboard(pending, job) |
746 jobs.signal_as_failed_if_needed(job, self._build_status_url(job), now) | 744 jobs.signal_as_failed_if_needed(job, self._build_status_url(job), now) |
747 | 745 |
748 return True | 746 return True |
OLD | NEW |