diff options
author | Stephen Hines <srhines@google.com> | 2022-01-05 21:47:21 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2022-01-05 21:47:21 -0800 |
commit | 7bc245bad95c6f4c15bc3f819f61312705b59a5a (patch) | |
tree | cf4cdad04e1c146844e2a790910cf9cd1b97082a /pgo_tools/monitor_pgo_profiles.py | |
parent | f103b9f78baa21b4edf25d5dd5a1226b6c0ff159 (diff) | |
parent | dbc8cb672a14f4a8bb136074817c71a22f743eaf (diff) | |
download | toolchain-utils-7bc245bad95c6f4c15bc3f819f61312705b59a5a.tar.gz |
Merging 32 commit(s) from Chromium's toolchain-utilsandroid-t-preview-2android-t-preview-1android-t-beta-3android-s-v2-beta-3android-s-qpr3-beta-1android-t-preview-1android-s-v2-beta-3android-s-qpr3-beta-1
Merged commit digest:
dbc8cb67 compiler_wrapper: Use ld.bfd to detect binutils path
0274702f patch_sync: Add show subcommand
7fd98520 patch_sync: Add patch_parsing module
72bb9a35 patch_sync: Base code, version control managing
457d96b5 pgo_tools: make monitor_pgo_profiles fail rather than emailing
ed486b7b afdo_metadata: Publish the new kernel profiles
a170d3e2 crosperf: remove dead bob DUT
d60f468c afdo_metadata: Publish the new kernel profiles
26b91865 llvm_tools: Update get_upstream_patch schema
811429e3 llvm_tools: Catch dup SHAs in get_upstream_patch
ed2aa295 compiler_wrapper: Drop "-fno-experimental-pass-manager"
e8d03f7e rust_watch: report bugs for new minor or major versions of rustc
443e0b36 cros_utils: Add a bug reporting module
86fe58c1 compiler_wrapper: adds ${sysroot}/usr/lib to linker path
d02a62da compiler_wrapper: add missing unused-but-set-var
50d42705 afdo_metadata: Publish the new kernel profiles
7afc3522 llvm_tools: Make skip_dependencies optional
9de6ecbf crosperf: Increase timeout for a crosfleet call
58a779e7 llvm_tools: adds a way to skip dependencies when pulling from Phab
28d6cbe1 crosperf: Replace non-inclusive language
c965dab6 afdo_metadata: Publish the new kernel profiles
58bc0488 crosperf: Update default_remotes to new DUTs
70c83ac3 Replace non-inclusive language
d080198a llvm_tools: fix yapf warnings
5200728b llvm_tools: Add lldb_server to updated_packages
afd2d4b0 compiler_wrapper: ignore unused_but_set_variable
217c68a1 Add crosperf_autolock.py wrapper
dcb168bf afdo_metadata: Publish the new kernel profiles
a7a19342 Auto-format the crosperf files
c5e12fba Add 'no_lock' crosperf setting
ec4d2aec afdo_metadata: Publish the new kernel profiles
2c5d6278 compiler_wrapper: move llvmnext flag to post flags
Change-Id: Id8af179e775f6fe23c22ce05b8be9b5b02ccbaf4
Diffstat (limited to 'pgo_tools/monitor_pgo_profiles.py')
-rwxr-xr-x | pgo_tools/monitor_pgo_profiles.py | 70 |
1 files changed, 19 insertions, 51 deletions
diff --git a/pgo_tools/monitor_pgo_profiles.py b/pgo_tools/monitor_pgo_profiles.py index be159b94..5c17423b 100755 --- a/pgo_tools/monitor_pgo_profiles.py +++ b/pgo_tools/monitor_pgo_profiles.py @@ -7,14 +7,11 @@ import argparse import datetime -import sys -import subprocess import logging +import subprocess +import sys from typing import List, NamedTuple, Optional, Tuple -from cros_utils import email_sender -from cros_utils import tiny_render - PGO_BUILDBOT_LINK = ('https://ci.chromium.org/p/chromeos/builders/toolchain/' 'pgo-generate-llvm-next-orchestrator') @@ -54,47 +51,35 @@ def fetch_most_recent_profdata(arch: str) -> ProfdataInfo: return max(infos) -def compose_complaint_email( +def compose_complaint( out_of_date_profiles: List[Tuple[datetime.datetime, ProfdataInfo]] -) -> Optional[Tuple[str, tiny_render.Piece]]: +) -> Optional[str]: if not out_of_date_profiles: return None if len(out_of_date_profiles) == 1: - subject = '1 llvm profile is out of date' - body = ['out-of-date profile:'] + body_lines = ['1 profile is out of date:'] else: - subject = f'{len(out_of_date_profiles)} llvm profiles are out of date' - body = ['out-of-date profiles:'] + body_lines = [f'{len(out_of_date_profiles)} profiles are out of date:'] - out_of_date_items = [] for arch, profdata_info in out_of_date_profiles: - out_of_date_items.append( - f'{arch} (most recent profile was from {profdata_info.date} at ' + body_lines.append( + f'- {arch} (most recent profile was from {profdata_info.date} at ' f'{profdata_info.location!r})') - body += [ - tiny_render.UnorderedList(out_of_date_items), - tiny_render.line_break, - tiny_render.line_break, + body_lines.append('\n') + body_lines.append( 'PTAL to see if the llvm-pgo-generate bots are functioning normally. ' - 'Their status can be found at ', - tiny_render.Link(href=PGO_BUILDBOT_LINK, inner=PGO_BUILDBOT_LINK), - '.', - ] - return subject, body + f'Their status can be found at {PGO_BUILDBOT_LINK}.') + return '\n'.join(body_lines) def main() -> None: logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument( - '--dry_run', - action='store_true', - help="Don't actually send an email", - ) + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( '--max_age_days', # These builders run ~weekly. If we fail to generate two in a row, @@ -119,29 +104,12 @@ def main() -> None: if age >= max_age: out_of_date_profiles.append((arch, most_recent)) - email = compose_complaint_email(out_of_date_profiles) - if not email: - logging.info('No email to send; quit') - return - - subject, body = email + complaint = compose_complaint(out_of_date_profiles) + if complaint: + logging.error('%s', complaint) + sys.exit(1) - identifier = 'llvm-pgo-monitor' - subject = f'[{identifier}] {subject}' - - logging.info('Sending email with title %r', subject) - if args.dry_run: - logging.info('Dry run specified\nSubject: %s\nBody:\n%s', subject, - tiny_render.render_text_pieces(body)) - else: - email_sender.EmailSender().SendX20Email( - subject=subject, - identifier=identifier, - well_known_recipients=['mage'], - direct_recipients=['gbiv@google.com'], - text_body=tiny_render.render_text_pieces(body), - html_body=tiny_render.render_html_pieces(body), - ) + logging.info('Nothing seems wrong') if __name__ == '__main__': |