Skip to content

Commit f09f3e9

Browse files
committed
Updating the lambda layers building processes
1 parent 8c0a6ec commit f09f3e9

13 files changed

+139
-120
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikiped
6262

6363
* AWS Data Wrangler practically only makes integrations. So we prefer to dedicate our energy / time writing integration tests instead of unit tests. We really like an end-to-end approach for all features.
6464

65-
* All integration tests are between the local enviroment and a remote and real AWS service.
65+
* All integration tests are between the local environment and a remote and real AWS services.
6666

67-
* We have a Cloudformation to set up the AWS end (testing/template.yaml).
67+
* We have a Cloudformation to set up the AWS end (testing/cloudformation.yaml).
6868

6969
## Step-by-step
7070

building/build-image.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

building/build-lambda-layers.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
VERSION=$(python -c "import awswrangler as wr; print(wr.__version__)")
5+
echo "Building Lambda Layers for AWS Data Wrangler ${VERSION}"
6+
DIR_NAME=$(dirname "$PWD")
7+
8+
pushd lambda
9+
10+
# Building all related docker images
11+
./build-docker-images.sh
12+
13+
# Building Apache Arrow binary artifacts
14+
docker run \
15+
--volume "$DIR_NAME":/aws-data-wrangler/ \
16+
--workdir /aws-data-wrangler/building/lambda \
17+
-it \
18+
awswrangler-build-py36 \
19+
build-apache-arrow.sh
20+
21+
# Generating PyArrow Files for Python 3.6
22+
#docker run \
23+
# --volume "$DIR_NAME":/aws-data-wrangler/ \
24+
# --workdir /aws-data-wrangler/building/lambda \
25+
# -it \
26+
# awswrangler-build-py36 \
27+
# build-pyarrow.sh
28+
29+
# Building the AWS Lambda Layer for Python 3.6
30+
#docker run \
31+
# --volume "$DIR_NAME":/aws-data-wrangler/ \
32+
# --workdir /aws-data-wrangler/building/lambda \
33+
# -it \
34+
# awswrangler-build-py36 \
35+
# build-layer.sh "${VERSION}-py3.6"

building/build-pyarrow.sh

Lines changed: 0 additions & 62 deletions
This file was deleted.

building/deploy-source.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
FROM lambci/lambda:build-python3.6
1+
ARG base_image
2+
ARG py_dev
3+
4+
FROM ${base_image}
25

36
RUN yum install -y \
47
boost-devel \
58
jemalloc-devel \
69
bison \
710
flex \
811
autoconf \
9-
python36-devel
12+
${py_dev}
1013

11-
RUN pip3 install --upgrade pip six cython pytest cmake wheel
14+
RUN pip3 install --upgrade pip six cython cmake
1215

1316
ADD requirements.txt /root/
1417
RUN pip3 install -r /root/requirements.txt
15-
RUN rm -rf /root/requirements.txt
18+
1619
ADD requirements-dev.txt /root/
1720
RUN pip3 install -r /root/requirements-dev.txt
18-
RUN rm -rf /root/requirements-dev.txt
1921

20-
RUN pip3 install boto3==1.12.22 botocore==1.15.22 awscli==1.18.22
22+
RUN rm -rf /root/requirements*
2123

2224
ENTRYPOINT ["/bin/sh"]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
rm -rf arrow dist
5+
6+
git clone \
7+
--branch apache-arrow-0.16.0 \
8+
--single-branch \
9+
https://github.com/apache/arrow.git
10+
11+
export ARROW_HOME=$(pwd)/dist
12+
export LD_LIBRARY_PATH=$(pwd)/dist/lib:$LD_LIBRARY_PATH
13+
14+
mkdir dist
15+
mkdir arrow/cpp/build
16+
pushd arrow/cpp/build
17+
18+
cmake \
19+
-DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
20+
-DCMAKE_INSTALL_LIBDIR=lib \
21+
-DARROW_FLIGHT=OFF \
22+
-DARROW_GANDIVA=OFF \
23+
-DARROW_ORC=OFF \
24+
-DARROW_WITH_SNAPPY=ON \
25+
-DARROW_WITH_ZLIB=ON \
26+
-DARROW_PARQUET=ON \
27+
-DARROW_CSV=OFF \
28+
-DARROW_PYTHON=ON \
29+
-DARROW_PLASMA=OFF \
30+
-DARROW_BUILD_TESTS=OFF \
31+
..
32+
make -j
33+
make install
34+
35+
popd
36+
37+
rm -rf arrow
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
cp ../../requirements.txt .
5+
cp ../../requirements-dev.txt .
6+
7+
# Python 3.6
8+
docker build \
9+
--tag awswrangler-build-py36 \
10+
--build-arg base_image=lambci/lambda:build-python3.6 \
11+
--build-arg py_dev=python36-devel \
12+
.
13+
14+
# Python 3.7
15+
docker build \
16+
--tag awswrangler-build-py37 \
17+
--build-arg base_image=lambci/lambda:build-python3.7 \
18+
--build-arg py_dev=python37-devel \
19+
.
20+
21+
# Python 3.8
22+
docker build \
23+
--tag awswrangler-build-py38 \
24+
--build-arg base_image=lambci/lambda:build-python3.8 \
25+
--build-arg py_dev=python38-devel \
26+
.
27+
28+
rm -rf requirements*
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
#!/usr/bin/env bash
22
set -ex
33

4-
# Go back to AWSWRANGLER directory
5-
pushd /aws-data-wrangler
4+
FILENAME="awswrangler-layer-${1}.zip"
65

7-
# Build PyArrow files
8-
pushd building
9-
./build-pyarrow.sh
10-
popd
6+
pushd /aws-data-wrangler
117

12-
# Preparing directories
138
mkdir -p dist
14-
rm -rf python
15-
rm -f "awswrangler-layer.zip"
16-
rm -f "dist/awswrangler-layer.zip"
9+
rm -rf python "${FILENAME}" "dist/${FILENAME}"
1710

18-
# Building
1911
pip install . -t ./python
2012
rm -rf python/pyarrow*
2113
rm -rf python/boto*
@@ -24,8 +16,7 @@ rm -f /aws-data-wrangler/dist/pyarrow_files/pyarrow/libparquet.so
2416
rm -f /aws-data-wrangler/dist/pyarrow_files/pyarrow/libarrow_python.so
2517
cp -r /aws-data-wrangler/dist/pyarrow_files/pyarrow* python/
2618
find python -wholename "*/tests/*" -type f -delete
27-
zip -r9 "awswrangler-layer.zip" ./python
28-
mv "awswrangler-layer.zip" dist/
19+
zip -r9 "${FILENAME}" ./python
20+
mv "${FILENAME}" dist/
2921

30-
# Cleaning up the directory again
3122
rm -rf python

building/lambda/build-pyarrow.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
rm -rf /aws-data-wrangler/dist/pyarrow_files
5+
6+
pushd arrow/python
7+
8+
export ARROW_PRE_0_15_IPC_FORMAT=0
9+
export PYARROW_WITH_HDFS=0
10+
export PYARROW_WITH_FLIGHT=0
11+
export PYARROW_WITH_GANDIVA=0
12+
export PYARROW_WITH_ORC=0
13+
export PYARROW_WITH_CUDA=0
14+
export PYARROW_WITH_PARQUET=1
15+
16+
python setup.py build_ext \
17+
--build-type=release \
18+
--bundle-arrow-cpp \
19+
bdist_wheel
20+
21+
pip install dist/pyarrow-*.whl -t /aws-data-wrangler/dist/pyarrow_files
22+
23+
rm -rf dist

0 commit comments

Comments
 (0)