Revert "Assign a label for level of bloat diff (#27880)" (#27925)

This reverts commit 882cc1259e.
pull/27926/head
Craig Tiller 3 years ago committed by GitHub
parent ef9ed33267
commit f2b96000a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      third_party/bloaty
  2. 32
      tools/profiling/bloat/bloat_diff.py
  3. 48
      tools/run_tests/python_utils/check_on_pr.py
  4. 2
      tools/run_tests/sanity/check_submodules.sh

@ -1 +1 @@
Subproject commit 60209eb1ccc34d5deefb002d1b7f37545204f7f2 Subproject commit 73594cde8c9a52a102c4341c244c833aa61b9c06

@ -15,12 +15,9 @@
# limitations under the License. # limitations under the License.
import argparse import argparse
import csv
import glob import glob
import math
import multiprocessing import multiprocessing
import os import os
import pathlib
import shutil import shutil
import subprocess import subprocess
import sys import sys
@ -74,48 +71,27 @@ if args.diff_base:
subprocess.check_call(['git', 'checkout', where_am_i]) subprocess.check_call(['git', 'checkout', where_am_i])
subprocess.check_call(['git', 'submodule', 'update']) subprocess.check_call(['git', 'submodule', 'update'])
pathlib.Path('bloaty-build').mkdir(exist_ok=True) subprocess.check_call('make -j%d' % args.jobs,
subprocess.check_call( shell=True,
['cmake', '-G', 'Unix Makefiles', '../third_party/bloaty'], cwd='third_party/bloaty')
cwd='bloaty-build')
subprocess.check_call('make -j%d' % args.jobs, shell=True, cwd='bloaty-build')
text = '' text = ''
diff_size = 0
for lib in LIBS: for lib in LIBS:
text += '****************************************************************\n\n' text += '****************************************************************\n\n'
text += lib + '\n\n' text += lib + '\n\n'
old_version = glob.glob('bloat_diff_old/%s' % lib) old_version = glob.glob('bloat_diff_old/%s' % lib)
new_version = glob.glob('bloat_diff_new/%s' % lib) new_version = glob.glob('bloat_diff_new/%s' % lib)
assert len(new_version) == 1 assert len(new_version) == 1
cmd = 'bloaty-build/bloaty -d compileunits,symbols' cmd = 'third_party/bloaty/bloaty -d compileunits,symbols'
if old_version: if old_version:
assert len(old_version) == 1 assert len(old_version) == 1
text += subprocess.check_output('%s %s -- %s' % text += subprocess.check_output('%s %s -- %s' %
(cmd, new_version[0], old_version[0]), (cmd, new_version[0], old_version[0]),
shell=True).decode() shell=True).decode()
for filename in [old_version, new_version]:
subprocess.check_call('strip %s' % filename[0], shell=True)
sections = [
x for x in csv.reader(
subprocess.check_output('bloaty-build/bloaty --csv %s -- %s' %
(old_version[0], new_version[0]),
shell=True).decode().splitlines())
]
print(sections)
for section in sections[1:]:
diff_size += int(section[2])
else: else:
text += subprocess.check_output('%s %s' % (cmd, new_version[0]), text += subprocess.check_output('%s %s' % (cmd, new_version[0]),
shell=True).decode() shell=True).decode()
text += '\n\n' text += '\n\n'
severity = int(
math.copysign(max(0, math.log(abs(diff_size) / 1000, 10),
diff_size))) if diff_size != 0 else 0
print("SEVERITY: %d" % severity)
print(text) print(text)
check_on_pr.check_on_pr('Bloat Difference', '```\n%s\n```' % text) check_on_pr.check_on_pr('Bloat Difference', '```\n%s\n```' % text)
check_on_pr.label_significance_on_pr('bloat', severity)

@ -33,14 +33,6 @@ _ACCESS_TOKEN_CACHE = None
_ACCESS_TOKEN_FETCH_RETRIES = 6 _ACCESS_TOKEN_FETCH_RETRIES = 6
_ACCESS_TOKEN_FETCH_RETRIES_INTERVAL_S = 15 _ACCESS_TOKEN_FETCH_RETRIES_INTERVAL_S = 15
_CHANGE_LABELS = {
-1: 'improvement',
0: 'none',
1: 'low',
2: 'medium',
3: 'high',
}
def _jwt_token(): def _jwt_token():
github_app_key = open( github_app_key = open(
@ -147,43 +139,3 @@ def check_on_pr(name, summary, success=True):
}) })
print('Result of Creating/Updating Check on PR:', print('Result of Creating/Updating Check on PR:',
json.dumps(resp.json(), indent=2)) json.dumps(resp.json(), indent=2))
def label_significance_on_pr(name, change):
"""Add a label to the PR indicating the significance of the check.
Requires environment variable 'KOKORO_GITHUB_PULL_REQUEST_NUMBER' to indicate which pull request
should be updated.
Args:
name: The name of the label.
value: A str in Markdown to be used as the detail information of the label.
"""
if change < min(list(_CHANGE_LABELS.keys())):
change = min(list(_CHANGE_LABELS.keys()))
if change > max(list(_CHANGE_LABELS.keys())):
change = max(list(_CHANGE_LABELS.keys()))
value = _CHANGE_LABELS[change]
if 'KOKORO_GIT_COMMIT' not in os.environ:
print('Missing KOKORO_GIT_COMMIT env var: not checking')
return
if 'KOKORO_KEYSTORE_DIR' not in os.environ:
print('Missing KOKORO_KEYSTORE_DIR env var: not checking')
return
if 'KOKORO_GITHUB_PULL_REQUEST_NUMBER' not in os.environ:
print('Missing KOKORO_GITHUB_PULL_REQUEST_NUMBER env var: not checking')
return
resp = _call(
'/repos/%s/issues/%s/labels' %
(_GITHUB_REPO, os.environ['KOKORO_GITHUB_PULL_REQUEST_NUMBER']),
method='DELETE',
json=[
"%s/%s" % (name, v) for v in _CHANGE_LABELS.values() if v != value
])
print('Result of Deleting Labels on PR:', resp.text)
resp = _call(
'/repos/%s/issues/%s/labels' %
(_GITHUB_REPO, os.environ['KOKORO_GITHUB_PULL_REQUEST_NUMBER']),
method='POST',
json=["%s/%s" % (name, value)])
print('Result of Adding Label on PR:', resp.text)

@ -27,7 +27,7 @@ git submodule | awk '{ print $2 " " $1 }' | sort >"$submodules"
cat <<EOF | sort >"$want_submodules" cat <<EOF | sort >"$want_submodules"
third_party/abseil-cpp 278e0a071885a22dcd2fd1b5576cc44757299343 third_party/abseil-cpp 278e0a071885a22dcd2fd1b5576cc44757299343
third_party/benchmark 0baacde3618ca617da95375e0af13ce1baadea47 third_party/benchmark 0baacde3618ca617da95375e0af13ce1baadea47
third_party/bloaty 60209eb1ccc34d5deefb002d1b7f37545204f7f2 third_party/bloaty 73594cde8c9a52a102c4341c244c833aa61b9c06
third_party/boringssl-with-bazel 95b3ed1b01f2ef1d72fed290ed79fe1b0e7dafc0 third_party/boringssl-with-bazel 95b3ed1b01f2ef1d72fed290ed79fe1b0e7dafc0
third_party/cares/cares e982924acee7f7313b4baa4ee5ec000c5e373c30 third_party/cares/cares e982924acee7f7313b4baa4ee5ec000c5e373c30
third_party/envoy-api 20b1b5fcee88a20a08b71051a961181839ec7268 third_party/envoy-api 20b1b5fcee88a20a08b71051a961181839ec7268

Loading…
Cancel
Save