Skip to content

Commit 2fe16db

Browse files
committed
sync
1 parent d11b76e commit 2fe16db

13 files changed

+111
-51
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#### Style and formatting:
66

7-
I have run `pre-commit install` to ensure that auto-formatting happens with every commit.
7+
I have run `pre-commit install && pre-commit run --all-files` to ensure that auto-formatting happens with every commit.
88

99
#### Issue number, if available
1010

compile_protobuf.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# Standard Library
4+
import glob
5+
import logging
6+
import os
7+
import platform
8+
import shutil
9+
import sys
10+
import tempfile
11+
import time
12+
import urllib
13+
import urllib.request
14+
from subprocess import check_call
15+
from zipfile import ZipFile
16+
17+
18+
def script_name() -> str:
19+
""":returns: script name with leading paths removed"""
20+
return os.path.split(sys.argv[0])[1]
21+
22+
23+
def configure_logging():
24+
logging.getLogger().setLevel(logging.INFO)
25+
logging.basicConfig(format="{}: %(asctime)sZ %(levelname)s %(message)s".format(script_name()))
26+
logging.Formatter.converter = time.gmtime
27+
28+
29+
def _get_system_details():
30+
return platform.system()
31+
32+
33+
def _get_machine_details():
34+
return platform.machine()
35+
36+
37+
def get_protoc_download_url():
38+
"""
39+
Returns an archive with the binary protoc distro for the platform
40+
"""
41+
42+
system = _get_system_details()
43+
machine = _get_machine_details()
44+
if system == "Darwin":
45+
archive_url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-osx-x86_64.zip"
46+
logging.info("Downloading protoc for Darwin: %s", archive_url)
47+
elif system == "Linux":
48+
archive_url = f"https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-linux-{machine}.zip"
49+
logging.info("Downloading protoc for Linux: %s", archive_url)
50+
else:
51+
system = platform.system()
52+
raise RuntimeError(
53+
f"Could not find protoc for System: {system} Machine: {machine}.\
54+
Please install it manually by running sh protoc_downloader.sh"
55+
)
56+
return archive_url
57+
58+
59+
def get_protoc():
60+
"""make sure protoc is available, otherwise download it and return a tuple with the protoc
61+
binary and a temporary dir if it needed to be downloaded"""
62+
if shutil.which("protoc"):
63+
return shutil.which("protoc"), None
64+
65+
archive_url = get_protoc_download_url()
66+
(fname, headers) = urllib.request.urlretrieve(archive_url)
67+
tmpdir = tempfile.mkdtemp(prefix="protoc_smdebug")
68+
with ZipFile(fname, "r") as zipf:
69+
zipf.extractall(tmpdir)
70+
protoc_bin = os.path.join(tmpdir, "bin", "protoc")
71+
72+
# Make the binary executable
73+
os.chmod(protoc_bin, 0o755)
74+
return protoc_bin, tmpdir
75+
76+
77+
def compile_protobuf():
78+
"""
79+
Compile protobuf files for smdebug
80+
"""
81+
logging.info("Compile protobuf")
82+
logging.info("================")
83+
(protoc_bin, tmpdir) = get_protoc()
84+
cmd = [protoc_bin]
85+
proto_files = glob.glob("smdebug/core/tfevent/proto/*.proto")
86+
cmd.extend(proto_files)
87+
cmd.append("--python_out=.")
88+
logging.info("Call to protoc: %s", " ".join(cmd))
89+
check_call(cmd)
90+
if tmpdir:
91+
shutil.rmtree(tmpdir, ignore_errors=True)

config/buildspec.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ phases:
3030
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0 # silence output: https://askubuntu.com/a/668859/724247
3131
- sudo apt-get update -qq -o=Dpkg::Use-Pty=0
3232
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0
33-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
3433
- pip install --upgrade pip==20.3.3
3534
- pip install -q matplotlib==3.3.1 seaborn==0.10.1 nbconvert==5.6.1 papermill==2.1.2 flaky==3.7.0 beautifulsoup4==4.8.2 jupyter==1.0.0 scipy==1.5.2 scikit-learn==0.23.2 bokeh==2.2.3 simplejson==3.17.2
3635
- if [ "$run_pytest_xgboost" = "enable" ]; then pip install --upgrade pyYaml==5.1; else pip install -q pyYaml; fi

config/buildspec_build_wheel.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ phases:
1414
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0
1515
- sudo apt-get update -qq -o=Dpkg::Use-Pty=0
1616
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0
17-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
1817
- pip install --upgrade pip==20.3.3
1918
- pip install -q pytest==5.3.3 wheel pyYaml pytest-html pre-commit pytest-cov
2019
- pip uninstall -y boto3 && pip uninstall -y aiobotocore && pip uninstall -y botocore

config/buildspec_tensorflow_2_3.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ phases:
3535
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0 # silence output: https://askubuntu.com/a/668859/724247
3636
- sudo apt-get update -qq -o=Dpkg::Use-Pty=0
3737
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0
38-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
3938
- pip install --upgrade pip==19.3.1
4039
- pip install -q matplotlib==3.3.1 seaborn==0.10.1 nbconvert==5.6.1 papermill==2.1.2 flaky==3.7.0 beautifulsoup4==4.8.2 jupyter==1.0.0 scipy==1.5.2 scikit-learn==0.23.2 bokeh==2.2.3 simplejson==3.17.2 transformers==4.2.1
4140
- pip install -q pytest wheel pytest-html pre-commit awscli pytest-cov

config/buildspec_tensorflow_2_4.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ phases:
3030
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0 # silence output: https://askubuntu.com/a/668859/724247
3131
- sudo apt-get update -qq -o=Dpkg::Use-Pty=0
3232
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0
33-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
3433
- pip install --upgrade pip==19.3.1
3534
- pip install -q matplotlib==3.3.1 seaborn==0.10.1 nbconvert==5.6.1 papermill==2.1.2 flaky==3.7.0 beautifulsoup4==4.8.2 jupyter==1.0.0 scipy==1.5.2 scikit-learn==0.23.2 bokeh==2.2.3 simplejson==3.17.2 transformers==4.2.1
3635
- if [ "$run_pytest_xgboost" = "enable" ]; then pip install --upgrade pyYaml==5.1; else pip install -q pyYaml; fi

config/buildspec_vanilla_framework_tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ phases:
1818
- apt-get update
1919
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0
2020
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0
21-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
2221
- pip install --upgrade pip==20.3.3
2322
- pip install -q -U pytest pytest-cov wheel pyYaml pytest-html keras==2.3.1 mxnet==1.6.0 torch==1.8.0 xgboost==1.3.3 pre-commit tensorflow_datasets==4.0.1 torchvision
2423
- cd $CODEBUILD_SRC_DIR && chmod +x config/install_smdebug.sh && chmod +x config/check_smdebug_install.sh && ./config/install_smdebug.sh;

config/buildspec_xgboost_1_2_1.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ phases:
3333
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0 # silence output: https://askubuntu.com/a/668859/724247
3434
- pip install awscli==1.19.5
3535
- . config/change_branch.sh #EXPORTS BRANCHES FOR OTHER REPOS AND CURRENT REPO.
36-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
3736
- pip install --upgrade pip==19.3.1
3837
- pip install -q pytest==6.1.2 pytest-cov==2.10.1 wheel==0.35.1 pyYaml==5.3.1 pytest-html==3.0.0 sagemaker==2.16.3 pre-commit==2.6.0 flaky==3.7.0
3938
- pip install -q matplotlib==3.3.1 && pip3 install seaborn==0.10.1 nbconvert==5.6.1 papermill==2.1.2 beautifulsoup4==4.8.2 jupyter==1.0.0 scipy==1.5.2 scikit-learn==0.23.2 bokeh==2.2.3

config/buildspec_zero_code_change.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ phases:
2626
- apt-get update
2727
- apt-get install sudo -qq -o=Dpkg::Use-Pty=0
2828
- sudo apt-get install unzip -qq -o=Dpkg::Use-Pty=0
29-
- cd $CODEBUILD_SRC_DIR && chmod +x config/protoc_downloader.sh && ./config/protoc_downloader.sh
3029
- pip install --upgrade pip==20.3.3
3130
- pip install -q pytest wheel pyYaml pytest-html pre-commit awscli pytest-cov
3231
- cd $CODEBUILD_SRC_DIR && chmod +x config/install_smdebug.sh && chmod +x config/check_smdebug_install.sh && ./config/install_smdebug.sh;

config/profiler/requirements.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
pip==20.3.3
2-
wheel==0.35.1
3-
pyYaml==5.4
4-
pytest-html==3.0.0
5-
sagemaker==2.23.0
6-
pre-commit==2.6.0
7-
awscli==1.18.203
8-
pytest==6.1.2
9-
pytest-cov==2.10.1
2+
awscli==1.19.102
3+
wheel==0.36.2
4+
pyYaml==5.4.1
5+
pytest-html==3.1.1
6+
sagemaker==2.47.1
7+
pre-commit==2.13.0
8+
pytest==6.2.4
9+
pytest-cov==2.12.1
1010
flaky==3.7.0
11-
pytest-xdist==2.2.0
12-
pandas==1.1.5
11+
pytest-xdist==2.3.0
12+
pandas==1.2.5

0 commit comments

Comments
 (0)