Skip to content

Commit

Permalink
[ews-build] Make should_send_email_for_patch asynchronous
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=254450
rdar://107209666

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps.py:
(BugzillaMixin.should_send_email_for_patch): Make asynchronous.
(AnalyzeCompileWebKitResults.send_email_for_new_build_failure): Treat
should_send_email_for_patch as asynchronous.
(AnalyzeLayoutTestsResults.send_email_for_new_test_failures): Ditto.

Canonical link: https://commits.webkit.org/263175@main
  • Loading branch information
JonWBedard committed Apr 20, 2023
1 parent b234333 commit b98dad5
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions Tools/CISupport/ews-build/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,26 +1539,27 @@ def _is_bug_closed(self, bug_id):
return defer.returnValue(1)
return defer.returnValue(0)

@defer.inlineCallbacks
def should_send_email_for_patch(self, patch_id):
patch_json = self.get_patch_json(patch_id)
if not patch_json:
self._addToLog('stdio', 'Unable to fetch patch {}'.format(patch_id))
return True
yield self._addToLog('stdio', 'Unable to fetch patch {}'.format(patch_id))
return defer.returnValue(True)

obsolete = patch_json.get('is_obsolete')
if obsolete == 1:
self._addToLog('stdio', 'Skipping email since patch {} is obsolete'.format(patch_id))
return False
yield self._addToLog('stdio', 'Skipping email since patch {} is obsolete'.format(patch_id))
return defer.returnValue(False)

review_denied = False
for flag in patch_json.get('flags', []):
if flag.get('name') == 'review' and flag.get('status') == '-':
review_denied = True

if review_denied:
self._addToLog('stdio', 'Skipping email since patch {} is marked r-'.format(patch_id))
return False
return True
yield self._addToLog('stdio', 'Skipping email since patch {} is marked r-'.format(patch_id))
return defer.returnValue(False)
return defer.returnValue(True)

def send_email_for_infrastructure_issue(self, infrastructure_issue_text):
try:
Expand Down Expand Up @@ -2900,8 +2901,10 @@ def send_email_for_new_build_failure(self):
pr_number = self.getProperty('github.number', '')
sha = self.getProperty('github.head.sha', '')[:HASH_LENGTH_TO_DISPLAY]

if patch_id and not self.should_send_email_for_patch(patch_id):
return
if patch_id:
should_send_email = yield self.should_send_email_for_patch(patch_id)
if not should_send_email:
return
if pr_number:
should_send_email = yield self.should_send_email_for_pr(pr_number, self.getProperty('repository'))
if not should_send_email:
Expand Down Expand Up @@ -3880,8 +3883,10 @@ def send_email_for_new_test_failures(self, test_names, exceed_failure_limit=Fals
pr_number = self.getProperty('github.number', '')
sha = self.getProperty('github.head.sha', '')[:HASH_LENGTH_TO_DISPLAY]

if patch_id and not self.should_send_email_for_patch(patch_id):
return
if patch_id:
should_send_email = yield self.should_send_email_for_patch(patch_id)
if not should_send_email:
return
if pr_number:
should_send_email = yield self.should_send_email_for_pr(pr_number, self.getProperty('repository'))
if not should_send_email:
Expand Down

0 comments on commit b98dad5

Please sign in to comment.