Chromium Code Reviews| Index: commit-queue/verification/try_job_on_rietveld.py |
| =================================================================== |
| --- commit-queue/verification/try_job_on_rietveld.py (revision 229881) |
| +++ commit-queue/verification/try_job_on_rietveld.py (working copy) |
| @@ -9,8 +9,10 @@ |
| """ |
| import collections |
| +import errno |
| import logging |
| import re |
| +import socket |
| import time |
| import urllib2 |
| @@ -773,27 +775,44 @@ |
| """ |
| status = buildbot_json.Buildbot(self.try_server_url) |
| try: |
| - data = self.context.rietveld.get_patchset_properties( |
| - pending.issue, pending.patchset) |
| + try: |
| + data = self.context.rietveld.get_patchset_properties( |
| + pending.issue, pending.patchset) |
| + except urllib2.HTTPError as e: |
| + if e.code == 404: |
| + # TODO(phajdan.jr): Maybe generate a random id to correlate the user's |
| + # error message and exception in the logs. |
| + # Don't put exception traceback in the user-visible message to avoid |
| + # leaking sensitive CQ data (passwords etc). |
| + jobs.error_message = ('Failed to get patchset properties (patchset ' |
| + 'not found?)') |
| + logging.error(str(e)) |
| + return False |
| + else: |
|
Isaac (away)
2013/10/24 17:25:41
Would this make more sense for rietveld.py to hand
Paweł Hajdan Jr.
2013/10/24 18:28:12
I don't think so. If anything, it might be better
Isaac (away)
2013/10/24 19:01:33
Python 3 supports native exception chaining. In P
|
| + raise |
| + |
| + # Update the RietvedTryJobs object. |
| + keys = jobs.update_jobs_from_rietveld( |
| + pending.owner, |
| + pending.issue, |
| + data, |
| + status, |
| + self.context.checkout, |
| + now) |
| except urllib2.HTTPError as e: |
| - if e.code == 404: |
| - # TODO(phajdan.jr): Maybe generate a random id to correlate the user's |
| - # error message and exception in the logs. |
| - # Don't put exception traceback in the user-visible message to avoid |
| - # leaking sensitive CQ data (passwords etc). |
| - jobs.error_message = ('Failed to get patchset properties (patchset ' |
| - 'not found?)') |
| - logging.error(str(e)) |
| - return False |
| - elif e.code == 500: |
| + if e.code in (500, 502, 503): |
| # Temporary AppEngine hiccup. Just log it and return failure. |
| logging.warning(str(e)) |
| return False |
| else: |
| raise |
| - # Update the RietvedTryJobs object. |
| - keys = jobs.update_jobs_from_rietveld( |
| - pending.owner, pending.issue, data, status, self.context.checkout, now) |
| + except socket.error as e: |
| + # Temporary AppEngine hiccup. Just log it and return failure. |
| + if e.errno == errno.ECONNRESET: |
|
Isaac (away)
2013/10/24 17:25:41
We're now raising if this doesn't match?
Paweł Hajdan Jr.
2013/10/24 18:28:12
If we're catching it here it means something in th
|
| + logging.warning(str(e)) |
| + return False |
| + else: |
| + raise |
| if handle: |
| for updated_key in keys: |
| job = jobs.try_jobs[updated_key] |