Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Commit 4f7f90f

Browse files
Code0x58Neng Lunicknezishuijunwu
authored
Python 3 upgrade (#3522)
* Initial Python 3 upgrade effort * Fixes towards python3 support * update heronpy release scripts for python3 * update dist Dockerfiles to only use python3 * remove python2 from docker images * upgrade pylint for python3 support * upgrade PEX so transative dependencies are captured Additionally: * fix Ubuntu 16.04 images * fix linting issues found by newer pylint There is an issue with encapsulation in the builds where the global python3 environment is used while PEX installs a nested transitive dependency of pylint: `pylint>astroid>wrapt`. This seems to be because of logic in its setup.py which can be disabled with `WRAPT_INSTALL_EXTENSIONS=false` * Fix new pylint issues * update setuptools * Make pex_pytest non-zip-safe * Rough proto_library fix The issue encountered was protocolbuffers/protobuf#1491 which may be fixed by a pending PR to protoc, or with a switch to the official protobuf rules and the import_prefix parameter to proto_library. * WIP: Fix python3 incompatibilities * bytes vs str issues * update kazoo * order of processes in executor test changed due to dict ordering? * some places needed / switched to // - may be more not caught by tests * add travis_wait as some stages going over 10 minutes without output in CI TODO: * make sure the kazoo upgrade is correct, it was done only by updating package versoin * Try fixing build time issue in travis * Upgrade docker rules * Upgrade to python3 in CI * Fix python integration tests * Fix more bytes vs str errors + update vagrant * Update Travis to Python3.7 + fix Vagrant on mac * Reduce requirement to python3.6 + py3 fixes * use universal_newline in popen instead of text in Popen for py3.6 * fix bytes/str issues in deserialisation * fix file open modes * use set instead of sets.Set * fix __import__(level) default * Update cloudpickle * Fix python addressing of release.yaml * Additions to get docker image builds working and tested * use new external pkg_* rules * add python to compile docker images until pkg_* * add --host_force_python=PY3 to other bazel.rc files * WIP: Add CI for docker images/releases * use kind to create ephemeral clusters * start consolidating scripts with python * Fix helm chart * bytes vs str fix * Mention Python 3.6 requirement in README.md * updatedockerfile Co-authored-by: Neng Lu <[email protected]> Co-authored-by: Nicholas Nezis <[email protected]> Co-authored-by: bed debug <[email protected]> Co-authored-by: huijunwu <[email protected]>
1 parent 7544160 commit 4f7f90f

File tree

336 files changed

+2474
-1959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+2474
-1959
lines changed

.travis.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ addons:
1616
packages:
1717
- libtool-bin
1818
- libcppunit-dev
19+
- python3
1920
- pkg-config
20-
- python-dev
21-
- python-wheel
21+
- python3-dev
22+
- python3-wheel
2223
- wget
2324
- zip
2425
- zlib1g-dev
@@ -34,13 +35,17 @@ before_install:
3435
- chmod +x bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
3536
- ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh --user
3637

38+
install:
39+
- sudo apt-get install python3-pip python3-setuptools
40+
- pip3 install travis-wait-improved
41+
3742
script:
3843
- which gcc
3944
- gcc --version
4045
- which g++
4146
- g++ --version
4247
- which python
4348
- python -V
44-
- which python2.7
45-
- python2.7 -V
46-
- scripts/travis/ci.sh
49+
- which python3
50+
- python3 -V
51+
- travis-wait-improved --timeout=180m scripts/travis/ci.sh

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Confluence: https://cwiki.apache.org/confluence/display/HERON
3131

3232
#### Heron Requirements:
3333
* Java 11
34-
* Python 2.7
34+
* Python 3.6
3535
* Bazel 3.0.0
3636

3737
## Contact

WORKSPACE

+26-13
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ py_repositories()
171171
# pip_repositories()
172172

173173
# for pex repos
174-
PEX_SRC = "https://pypi.python.org/packages/3a/1d/cd41cd3765b78a4353bbf27d18b099f7afbcd13e7f2dc9520f304ec8981c/pex-1.2.15.tar.gz"
174+
PEX_WHEEL = "https://pypi.python.org/packages/18/92/99270775cfc5ddb60c19588de1c475f9ff2837a6e0bbd5eaa5286a6a472b/pex-2.1.9-py2.py3-none-any.whl"
175175

176176
PY_WHEEL = "https://pypi.python.org/packages/53/67/9620edf7803ab867b175e4fd23c7b8bd8eba11cb761514dcd2e726ef07da/py-1.4.34-py2.py3-none-any.whl"
177177

178178
PYTEST_WHEEL = "https://pypi.python.org/packages/fd/3e/d326a05d083481746a769fc051ae8d25f574ef140ad4fe7f809a2b63c0f0/pytest-3.1.3-py2.py3-none-any.whl"
179179

180180
REQUESTS_SRC = "https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d9e96a14fda828b18199800d161bcefc1359/requests-2.12.3.tar.gz"
181181

182-
SETUPTOOLS_SRC = "https://pypi.python.org/packages/68/13/1bfbfbd86560e61fa9803d241084fff41a775bf56ee8b3ad72fc9e550dad/setuptools-31.0.0.tar.gz"
182+
SETUPTOOLS_WHEEL = "https://pypi.python.org/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl"
183183

184184
VIRTUALENV_SRC = "https://pypi.python.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz"
185185

@@ -210,9 +210,9 @@ http_file(
210210

211211
http_file(
212212
name = "pex_src",
213-
downloaded_file_path = "pex-1.2.15.tar.gz",
214-
sha256 = "0147d19123340677b9793b00ec86fe65b6697db3ec99afb796da2300ae5fec14",
215-
urls = [PEX_SRC],
213+
downloaded_file_path = "pex-2.1.9-py2.py3-none-any.whl",
214+
sha256 = "5cad8d960c187541f71682fc938a843ef9092aab46f27b33ace7e570325e2626",
215+
urls = [PEX_WHEEL],
216216
)
217217

218218
http_file(
@@ -223,10 +223,10 @@ http_file(
223223
)
224224

225225
http_file(
226-
name = "setuptools_src",
227-
downloaded_file_path = "setuptools-31.0.0.tar.gz",
228-
sha256 = "0818cc0de692c3a5c83ca83aa7ec7ba6bc206f278735f1e0267b8d0e095cfe7a",
229-
urls = [SETUPTOOLS_SRC],
226+
name = "setuptools_wheel",
227+
downloaded_file_path = "setuptools-46.1.3-py3-none-any.whl",
228+
sha256 = "4fe404eec2738c20ab5841fa2d791902d2a645f32318a7850ef26f8d7215a8ee",
229+
urls = [SETUPTOOLS_WHEEL],
230230
)
231231

232232
http_archive(
@@ -367,11 +367,12 @@ http_archive(
367367
# end helm
368368

369369
# for docker image building
370+
DOCKER_RULES_VERSION = "0.14.1"
370371
http_archive(
371372
name = "io_bazel_rules_docker",
372-
sha256 = "aed1c249d4ec8f703edddf35cbe9dfaca0b5f5ea6e4cd9e83e99f3b0d1136c3d",
373-
strip_prefix = "rules_docker-0.7.0",
374-
urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.7.0.tar.gz"],
373+
sha256 = "dc97fccceacd4c6be14e800b2a00693d5e8d07f69ee187babfd04a80a9f8e250",
374+
strip_prefix = "rules_docker-%s" % DOCKER_RULES_VERSION,
375+
urls = ["https://github.com/bazelbuild/rules_docker/archive/v%s.tar.gz" % DOCKER_RULES_VERSION],
375376
)
376377

377378
load(
@@ -381,6 +382,10 @@ load(
381382

382383
container_repositories()
383384

385+
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
386+
387+
container_deps()
388+
384389
load(
385390
"@io_bazel_rules_docker//container:container.bzl",
386391
"container_pull",
@@ -391,11 +396,19 @@ container_pull(
391396
digest = "sha256:495800e9eb001dfd2fb41d1941155203bb9be06b716b0f8b1b0133eb12ea813c",
392397
registry = "index.docker.io",
393398
repository = "heron/base",
394-
tag = "0.4.0",
399+
tag = "0.5.0",
395400
)
396401

397402
# end docker image building
398403

404+
http_archive(
405+
name = "rules_pkg",
406+
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz",
407+
sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a",
408+
)
409+
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
410+
rules_pkg_dependencies()
411+
399412
# for nomad repear
400413
http_archive(
401414
name = "nomad_mac",

bazel_configure.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# Licensed to the Apache Software Foundation (ASF) under one
33
# or more contributor license agreements. See the NOTICE file
44
# distributed with this work for additional information
@@ -413,7 +413,7 @@ def main():
413413
env_map['AUTOMAKE'] = discover_tool('automake', 'Automake', 'AUTOMAKE', '1.9.6')
414414
env_map['AUTOCONF'] = discover_tool('autoconf', 'Autoconf', 'AUTOCONF', '2.6.3')
415415
env_map['MAKE'] = discover_tool('make', 'Make', 'MAKE', '3.81')
416-
env_map['PYTHON'] = discover_tool('python', 'Python', 'PYTHON', '2.7')
416+
env_map['PYTHON3'] = discover_tool('python3', 'Python3', 'PYTHON3', '3.4')
417417

418418
if platform == 'Darwin':
419419
env_map['LIBTOOL'] = discover_tool('glibtool', 'Libtool', 'LIBTOOL', '2.4.2')

config/configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ AM_CONDITIONAL([SYSLINUX], [test x$sys_os = xlinux])
100100
ACX_PTHREAD
101101

102102
# Check the python version required
103-
AM_PATH_PYTHON([2.4.3])
104-
AC_PATH_PROG([PYTHON], [python], [],[])
103+
AM_PATH_PYTHON([3.4])
104+
AC_PATH_PROG([PYTHON3], [python3], [],[])
105105

106106
abs_top_builddir=`pwd`
107107
AC_SUBST(abs_top_builddir)

deploy/kubernetes/minikube/apiserver.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
initContainers:
6565
- name: init-heron-apiserver
6666
image: apache/bookkeeper:4.7.3
67-
command: ['sh', '-c', '/opt/bookkeeper/bin/dlog admin bind -l /ledgers -s zookeeper:2181 -c distributedlog://zookeeper:2181/heron']
67+
command: ['sh', '-c', '/opt/bookkeeper/bin/dlog admin bind -l /ledgers -s zookeeper:2181 -c distributedlog://zookeeper:2181/heronbkdl']
6868
containers:
6969
- name: heron-apiserver
7070
image: heron/heron:latest
@@ -79,9 +79,9 @@ spec:
7979
-D heron.executor.docker.image=heron/heron:latest
8080
-D heron.class.uploader=org.apache.heron.uploader.dlog.DLUploader
8181
-D heron.uploader.dlog.topologies.num.replicas=1
82-
-D heron.uploader.dlog.topologies.namespace.uri=distributedlog://zookeeper:2181/heron
82+
-D heron.uploader.dlog.topologies.namespace.uri=distributedlog://zookeeper:2181/heronbkdl
8383
-D heron.statefulstorage.classname=org.apache.heron.statefulstorage.dlog.DlogStorage
84-
-D heron.statefulstorage.dlog.namespace.uri=distributedlog://zookeeper:2181/heron
84+
-D heron.statefulstorage.dlog.namespace.uri=distributedlog://zookeeper:2181/heronbkdl
8585
8686
---
8787
apiVersion: v1

deploy/kubernetes/minikube/bookkeeper.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ spec:
6565
envFrom:
6666
- configMapRef:
6767
name: bookie-config
68+
volumeMounts:
69+
- name: journal-disk
70+
mountPath: /bookkeeper/data/journal
71+
- name: ledgers-disk
72+
mountPath: /bookkeeper/data/ledgers
6873
containers:
6974
- name: bookie
7075
image: apache/bookkeeper:4.7.3
@@ -91,13 +96,11 @@ spec:
9196
valueFrom:
9297
fieldRef:
9398
fieldPath: status.hostIP
94-
9599
volumeMounts:
96100
- name: journal-disk
97101
mountPath: /bookkeeper/data/journal
98102
- name: ledgers-disk
99103
mountPath: /bookkeeper/data/ledgers
100-
101104
volumes:
102105
# Mount local disks
103106
- name: journal-disk

docker/base/Dockerfile.base.debian9

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ FROM openjdk:11-jdk-slim-stretch
1919

2020
RUN apt-get -y update && apt-get -y install \
2121
netcat-openbsd \
22-
python \
22+
python3 \
2323
unzip \
2424
curl \
2525
supervisor && \

docker/compile/Dockerfile.centos7

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ RUN yum -y install \
3535
libtool \
3636
make \
3737
patch \
38-
python-devel \
39-
cppunit-devel \
38+
python \
39+
python3-devel \
4040
zip \
4141
unzip \
4242
wget \

docker/compile/Dockerfile.debian10

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ RUN apt-get update && apt-get -y install \
3333
libcppunit-dev \
3434
pkg-config \
3535
python \
36-
python-dev \
36+
python3 \
37+
python3-dev \
3738
software-properties-common \
38-
python-setuptools \
39+
python3-setuptools \
3940
tree \
4041
zip \
4142
unzip \

docker/compile/Dockerfile.debian9

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ RUN apt-get update && apt-get -y install \
3232
libtool-bin \
3333
libcppunit-dev \
3434
pkg-config \
35-
python-dev \
36-
python3-dev \
3735
software-properties-common \
36+
python \
37+
python3-dev \
3838
python3-setuptools \
3939
tree \
4040
zip \

docker/compile/Dockerfile.ubuntu14.04

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ RUN apt-get update && apt-get -y install \
3333
libssl-dev \
3434
git \
3535
libtool \
36-
python-dev \
36+
python3-dev \
3737
pkg-config \
3838
libcppunit-dev \
3939
zip \

docker/compile/Dockerfile.ubuntu16.04

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,18 @@ RUN apt-get update && apt-get -y install \
3030
build-essential \
3131
cmake \
3232
curl \
33-
libssl-dev \
3433
git \
34+
libssl-dev \
3535
libtool-bin \
36-
libunwind8 \
3736
libunwind-setjmp0-dev \
37+
python \
38+
python3-dev \
3839
pkg-config \
39-
python-dev \
4040
libcppunit-dev \
41+
software-properties-common \
4142
tree \
42-
zip \
4343
unzip \
44+
zip \
4445
wget
4546

4647
RUN apt-get update && apt-get -y install \

docker/compile/Dockerfile.ubuntu18.04

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ RUN apt-get update && apt-get -y install \
2929
libunwind8 \
3030
libcppunit-dev \
3131
patch \
32-
python-dev \
32+
python \
33+
python3-dev \
3334
pkg-config \
3435
wget \
3536
zip \

docker/compile/Dockerfile.ubuntu20.04

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ RUN apt-get update && apt-get -y install \
3131
libunwind8 \
3232
libcppunit-dev \
3333
patch \
34-
python-dev \
34+
python3-dev \
35+
python \
3536
pkg-config \
3637
wget \
3738
zip \

docker/dist/Dockerfile.dist.centos7

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ RUN yum -y install epel-release \
2424
java-11-openjdk-headless \
2525
supervisor \
2626
nmap-ncat \
27-
python \
27+
python3 \
28+
python3-setuptools \
2829
unzip \
2930
which \
3031
&& yum clean all

docker/dist/Dockerfile.dist.debian10

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN apt-get update \
2121
&& apt-get -y install \
2222
curl \
2323
netcat-openbsd \
24-
python \
24+
python3 \
25+
python3-dev \
2526
supervisor \
2627
unzip \
2728
&& apt-get clean

docker/dist/Dockerfile.dist.debian9

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN apt-get -y update \
2121
&& apt-get -y install \
2222
curl \
2323
netcat-openbsd \
24-
python \
24+
python3 \
25+
python3-dev \
2526
supervisor \
2627
unzip \
2728
&& apt-get clean all \

docker/dist/Dockerfile.dist.ubuntu14.04

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN apt-get -y update \
2121
&& apt-get -y install \
2222
curl \
2323
netcat-openbsd \
24-
python \
24+
python3 \
25+
python3-distutils \
2526
software-properties-common \
2627
supervisor \
2728
unzip \

docker/dist/Dockerfile.dist.ubuntu16.04

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ RUN apt-get -y update \
2121
&& apt-get install -y \
2222
curl \
2323
netcat-openbsd \
24-
python \
24+
python3 \
25+
python3-distutils \
2526
software-properties-common \
2627
supervisor \
2728
unzip \

docker/dist/Dockerfile.dist.ubuntu18.04

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ RUN apt-get -y update \
2222
curl \
2323
netcat-openbsd \
2424
openjdk-11-jre-headless \
25-
python \
25+
python3 \
26+
python3-distutils \
2627
supervisor \
2728
unzip \
2829
&& apt-get clean

docker/dist/Dockerfile.dist.ubuntu20.04

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ RUN apt-get -y update \
2424
curl \
2525
openjdk-11-jre-headless \
2626
netcat-openbsd \
27-
python \
27+
python3 \
28+
python3-distutils \
2829
supervisor \
2930
unzip \
3031
&& apt-get clean

docker/test/Dockerfile.centos7

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN yum -y install \
3636
cppunit-devel \
3737
make \
3838
patch \
39-
python-devel \
39+
python3-devel \
4040
python3-devel \
4141
python3-setuptools \
4242
zip \

docker/test/Dockerfile.ubuntu18.04

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ RUN apt-get update && apt-get -y install \
2929
libunwind8 \
3030
libcppunit-dev \
3131
patch \
32-
python-dev \
3332
python3-dev \
3433
wget \
3534
zip \

0 commit comments

Comments
 (0)