Skip to content

Commit 458be40

Browse files
authored
Change link of latest tornasole binaries (aws#120)
* change link to binary and introduce latest * make container scripts working again * remove -U * fix path to ts binary in docker * log when single process is to stdout
1 parent f8ab089 commit 458be40

File tree

11 files changed

+103
-26
lines changed

11 files changed

+103
-26
lines changed

bin/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Locations
2+
## Tornasole binaries
3+
### Latest binaries
4+
##### MXNet
5+
```
6+
s3://tornasole-binaries-use1/tornasole_mxnet/py3/latest/
7+
```
8+
##### TensorFlow
9+
```
10+
s3://tornasole-binaries-use1/tornasole_tensorflow/py3/latest/
11+
```
12+
##### PyTorch
13+
```
14+
s3://tornasole-binaries-use1/tornasole_pytorch/py3/latest/
15+
```
16+
##### Rules
17+
```
18+
s3://tornasole-binaries-use1/tornasole_rules/py3/latest/
19+
```
20+
21+
### All versions
22+
```
23+
s3://tornasole-binaries-use1/tornasole_mxnet/py3/
24+
s3://tornasole-binaries-use1/tornasole_tensorflow/py3/
25+
s3://tornasole-binaries-use1/tornasole_pytorch/py3/
26+
s3://tornasole-binaries-use1/tornasole_rules/py3/
27+
```
28+
29+
## Containers
30+
#### TensorFlow
31+
```
32+
cpu us-west-2 072677473360.dkr.ecr.us-west-2.amazonaws.com/tornasole-preprod-tf-1.13.1-cpu:latest
33+
cpu us-east-1 072677473360.dkr.ecr.us-east-1.amazonaws.com/tornasole-preprod-tf-1.13.1-cpu:latest
34+
gpu us-west-2 072677473360.dkr.ecr.us-west-2.amazonaws.com/tornasole-preprod-tf-1.13.1-gpu:latest
35+
gpu us-east-1 072677473360.dkr.ecr.us-east-1.amazonaws.com/tornasole-preprod-tf-1.13.1-gpu:latest
36+
```
37+
#### MXNet
38+
```
39+
cpu us-west-2 072677473360.dkr.ecr.us-west-2.amazonaws.com/tornasole-preprod-mxnet-1.4.1-cpu:latest
40+
cpu us-east-1 072677473360.dkr.ecr.us-east-1.amazonaws.com/tornasole-preprod-mxnet-1.4.1-cpu:latest
41+
gpu us-west-2 072677473360.dkr.ecr.us-west-2.amazonaws.com/tornasole-preprod-mxnet-1.4.1-gpu:latest
42+
gpu us-east-1 072677473360.dkr.ecr.us-east-1.amazonaws.com/tornasole-preprod-mxnet-1.4.1-gpu:latest
43+
```
44+
#### PyTorch
45+
```
46+
cpu us-west-2 072677473360.dkr.ecr.us-west-2.amazonaws.com/tornasole-preprod-pytorch-1.1.0-cpu:latest
47+
cpu us-east-1 072677473360.dkr.ecr.us-east-1.amazonaws.com/tornasole-preprod-pytorch-1.1.0-cpu:latest
48+
gpu us-west-2 072677473360.dkr.ecr.us-west-2.amazonaws.com/tornasole-preprod-pytorch-1.1.0-gpu:latest
49+
gpu us-east-1 072677473360.dkr.ecr.us-east-1.amazonaws.com/tornasole-preprod-pytorch-1.1.0-gpu:latest
50+
```

bin/build_binaries.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
import argparse
33
import sys
44
import os
5+
import boto3
56

67
parser = argparse.ArgumentParser(description='Build Tornasole binaries')
78
parser.add_argument('--upload', default=False,
89
dest='upload', action='store_true',
910
help='Pass --upload if you want to upload the binaries'
1011
'built to the s3 location')
12+
parser.add_argument('--replace-latest', default=False,
13+
dest='replace_latest', action='store_true',
14+
help='Pass --replace-latest if you want to upload the new binary to '
15+
'replace the latest binary in the S3 location. Note that'
16+
'this also requires you to pass --upload')
1117
args = parser.parse_args()
1218

1319
VERSION = '0.3'
@@ -26,4 +32,13 @@
2632
subprocess.check_call(['aws', 's3', 'cp', 'dist/tornasole-{}-py2.py3-none-any.whl'.format(VERSION),
2733
's3://tornasole-binaries-use1/tornasole_{}/py3/'.format(b)])
2834

35+
if args.replace_latest:
36+
# upload current version
37+
subprocess.check_call(['aws', 's3', 'cp',
38+
's3://tornasole-binaries-use1/tornasole_{}/py3/tornasole-{}-py2.py3-none-any.whl'.format(b, VERSION),
39+
's3://tornasole-binaries-use1/tornasole_{}/py3/latest/'.format(b)])
40+
# remove other versions
41+
subprocess.check_call(['aws', 's3', 'rm', '--recursive', '--exclude', 'tornasole-{}*'.format(VERSION),
42+
's3://tornasole-binaries-use1/tornasole_{}/py3/latest/'.format(b)])
43+
2944
subprocess.check_call(['rm', '-rf', 'dist', 'build', '*.egg-info'])

bin/build_containers.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44
import os
55

66

7+
def run_command(command_list, stdout, stderr):
8+
subprocess.check_call(command_list, stdout=stdout, stderr=stderr)
9+
710
# you can clean all caches used by docker with `docker system prune -a`
811
def build_container(framework, version, args):
9-
with open(os.path.join(args.logs_path, '{}.log'.format(framework)), "w") as logfile:
10-
subprocess.check_call(['bash',
11-
'bin/sagemaker-containers/{}/{}/build.sh'.format(framework, version),
12-
args.tag], stdout=logfile, stderr=logfile)
12+
command = ['bash', 'bin/sagemaker-containers/{}/{}/build.sh'.format(framework, version), args.tag]
13+
if not args.single_process:
14+
with open(os.path.join(args.logs_path, '{}.log'.format(framework)), "w") as logfile:
15+
run_command(command, stdout=logfile, stderr=logfile)
16+
else:
17+
run_command(command, None, None)
1318

1419

1520
parser = argparse.ArgumentParser(description='Build Tornasole binaries')
16-
parser.add_argument('--tag', type=str, default='latest',
21+
parser.add_argument('--tag', type=str, default='temp',
1722
help='Pass the tag to upload the image to ECR with. '
1823
'You might want to set the tag to latest for '
1924
'final images.')

bin/sagemaker-containers/mxnet/1.4.1/build.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ tag_and_push() {
1111
done
1212
}
1313

14-
export TORNASOLE_BINARY_PATH=s3://tornasole-binaries-use1/tornasole_mxnet/py3/tornasole-0.3-py2.py3-none-any.whl
1514
export ECR_TAG_NAME=$1
1615

1716
cd bin/sagemaker-containers/mxnet/1.4.1/
18-
aws s3 cp $TORNASOLE_BINARY_PATH .
1917

20-
export ECR_REPO_NAME=tornasole-preprod-mxnet-1.4.1-gpu
18+
export TORNASOLE_BINARY_PATH=s3://tornasole-binaries-use1/tornasole_mxnet/py3/latest
19+
aws s3 sync $TORNASOLE_BINARY_PATH tornasole-binary
20+
cp tornasole-binary/*.whl .
21+
export TORNASOLE_BINARY=`ls tornasole-*.whl`
2122

23+
export ECR_REPO_NAME=tornasole-preprod-mxnet-1.4.1-gpu
2224
docker build -t $ECR_REPO_NAME:$ECR_TAG_NAME \
23-
--build-arg tornasole_installable=`basename $TORNASOLE_BINARY_PATH` \
25+
--build-arg tornasole_installable=$TORNASOLE_BINARY \
2426
-f Dockerfile.gpu .
2527
tag_and_push
2628

2729
export ECR_REPO_NAME=tornasole-preprod-mxnet-1.4.1-cpu
2830
docker build -t $ECR_REPO_NAME:$ECR_TAG_NAME \
29-
--build-arg tornasole_installable=`basename $TORNASOLE_BINARY_PATH` \
31+
--build-arg tornasole_installable=$TORNASOLE_BINARY \
3032
-f Dockerfile.cpu .
3133
tag_and_push

bin/sagemaker-containers/pytorch/1.1.0/build.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ tag_and_push() {
1111
done
1212
}
1313

14-
export TORNASOLE_BINARY_PATH=s3://tornasole-binaries-use1/tornasole_pytorch/py3/tornasole-0.3-py2.py3-none-any.whl
1514
export ECR_TAG_NAME=$1
1615

1716
pushd .
@@ -25,16 +24,19 @@ cd bin/sagemaker-containers/pytorch/1.1.0/
2524
cp ~/sagemaker-pytorch-container/dist/sagemaker_pytorch_container-*.whl .
2625
cp -r ~/sagemaker-pytorch-container/lib .
2726

28-
aws s3 cp $TORNASOLE_BINARY_PATH .
27+
export TORNASOLE_BINARY_PATH=s3://tornasole-binaries-use1/tornasole_mxnet/py3/latest
28+
aws s3 sync $TORNASOLE_BINARY_PATH tornasole-binary
29+
cp tornasole-binary/*.whl .
30+
export TORNASOLE_BINARY=`ls tornasole-*.whl`
2931

3032
export ECR_REPO_NAME=tornasole-preprod-pytorch-1.1.0-gpu
3133
docker build -t $ECR_REPO_NAME:$ECR_TAG_NAME --build-arg py_version=3 \
32-
--build-arg tornasole_framework_installable=`basename $TORNASOLE_BINARY_PATH` \
34+
--build-arg tornasole_framework_installable=$TORNASOLE_BINARY \
3335
-f Dockerfile.gpu .
3436
tag_and_push
3537

3638
export ECR_REPO_NAME=tornasole-preprod-pytorch-1.1.0-cpu
3739
docker build -t $ECR_REPO_NAME:$ECR_TAG_NAME --build-arg py_version=3 \
38-
--build-arg tornasole_framework_installable=`basename $TORNASOLE_BINARY_PATH` \
40+
--build-arg tornasole_framework_installable=$TORNASOLE_BINARY \
3941
-f Dockerfile.cpu .
4042
tag_and_push

bin/sagemaker-containers/tensorflow/1.13.1/Dockerfile.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ RUN pip install --no-cache-dir -U \
9595

9696
ARG tornasole_framework_installable
9797
COPY $tornasole_framework_installable .
98-
RUN pip install --no-cache-dir --force-reinstall -U $tornasole_framework_installable
98+
RUN pip install --no-cache-dir --force-reinstall $tornasole_framework_installable
9999

100100
ENV SAGEMAKER_TRAINING_MODULE sagemaker_tensorflow_container.training:main

bin/sagemaker-containers/tensorflow/1.13.1/Dockerfile.gpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ RUN ldconfig /usr/local/cuda-10.0/targets/x86_64-linux/lib/stubs && \
134134

135135
ARG tornasole_framework_installable
136136
COPY $tornasole_framework_installable .
137-
RUN pip install --no-cache-dir --force-reinstall -U $tornasole_framework_installable
137+
RUN pip install --no-cache-dir --force-reinstall $tornasole_framework_installable
138138

139139
ENV SAGEMAKER_TRAINING_MODULE sagemaker_tensorflow_container.training:main

bin/sagemaker-containers/tensorflow/1.13.1/build.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ tag_and_push() {
1111
done
1212
}
1313

14-
export TORNASOLE_BINARY_PATH=s3://tornasole-binaries-use1/tornasole_tensorflow/py3/tornasole-0.3-py2.py3-none-any.whl
1514
export ECR_TAG_NAME=$1
1615

1716
pushd .
@@ -24,7 +23,11 @@ python setup.py sdist
2423
popd
2524
cd bin/sagemaker-containers/tensorflow/1.13.1/
2625
cp ~/sagemaker-tensorflow-container/dist/sagemaker_tensorflow_container-*.tar.gz .
27-
aws s3 cp $TORNASOLE_BINARY_PATH .
26+
27+
export TORNASOLE_BINARY_PATH=s3://tornasole-binaries-use1/tornasole_mxnet/py3/latest
28+
aws s3 sync $TORNASOLE_BINARY_PATH tornasole-binary
29+
cp tornasole-binary/*.whl .
30+
export TORNASOLE_BINARY=`ls tornasole-*.whl`
2831

2932
export TF_ESTIMATOR_BINARY_LOCATION=https://tensorflow-aws.s3-us-west-2.amazonaws.com/1.13/Ubuntu/estimator/tensorflow_estimator-1.13.0-py2.py3-none-any.whl
3033
curl -O $TF_ESTIMATOR_BINARY_LOCATION
@@ -42,7 +45,7 @@ curl -O $TF_BINARY_LOCATION
4245
docker build -t $ECR_REPO_NAME:$ECR_TAG_NAME --build-arg py_version=3 \
4346
--build-arg framework_installable=`basename $TF_BINARY_LOCATION` \
4447
--build-arg framework_support_installable=sagemaker_tensorflow_container-*.tar.gz \
45-
--build-arg tornasole_framework_installable=`basename $TORNASOLE_BINARY_PATH` \
48+
--build-arg tornasole_framework_installable=$TORNASOLE_BINARY \
4649
--build-arg tf_estimator_installable=`basename $TF_ESTIMATOR_BINARY_LOCATION` \
4750
-f Dockerfile.gpu .
4851
tag_and_push
@@ -58,7 +61,7 @@ curl -O $TF_BINARY_LOCATION
5861
docker build -t $ECR_REPO_NAME:$ECR_TAG_NAME --build-arg py_version=3 \
5962
--build-arg framework_installable=`basename $TF_BINARY_LOCATION` \
6063
--build-arg framework_support_installable=sagemaker_tensorflow_container-*.tar.gz \
61-
--build-arg tornasole_framework_installable=`basename $TORNASOLE_BINARY_PATH` \
64+
--build-arg tornasole_framework_installable=$TORNASOLE_BINARY \
6265
--build-arg tf_estimator_installable=`basename $TF_ESTIMATOR_BINARY_LOCATION` \
6366
-f Dockerfile.cpu .
6467
tag_and_push

docs/mxnet/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ You can activate this by doing: `source activate mxnet_p36`.
4343
Once your account is whitelisted, you should be able to install the `tornasole` package built for MXNet as follows:
4444

4545
```
46-
aws s3 cp s3://tornasole-binaries-use1/tornasole_mxnet/py3/tornasole-0.3-py2.py3-none-any.whl .
47-
pip install tornasole-0.3-py2.py3-none-any.whl
46+
aws s3 sync s3://tornasole-binaries-use1/tornasole_mxnet/py3/latest/ tornasole_mxnet/
47+
pip install tornasole_mxnet/*
4848
```
4949

5050
**Please note** : If, while installing tornasole, you get a version conflict issue between botocore and boto3,

docs/pytorch/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ You can activate this by doing: `source activate pytorch_p36`.
4343
Once your account is whitelisted, you should be able to install the `tornasole` package built for PyTorch as follows:
4444

4545
```
46-
aws s3 cp s3://tornasole-binaries-use1/tornasole_pytorch/py3/tornasole-0.3-py2.py3-none-any.whl .
47-
pip install tornasole-0.3-py2.py3-none-any.whl
46+
aws s3 sync s3://tornasole-binaries-use1/tornasole_pytorch/py3/latest/ tornasole_pytorch/
47+
pip install tornasole_pytorch/*
4848
```
4949

5050
**Please note** : If, while installing tornasole, you get a version conflict issue between botocore and boto3,

docs/tensorflow/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ You can activate this by doing: `source activate tensorflow_p36`.
4343
Once your account is whitelisted, you should be able to install the `tornasole` package built for TensorFlow as follows:
4444

4545
```
46-
aws s3 cp s3://tornasole-binaries-use1/tornasole_tensorflow/py3/tornasole-0.3-py2.py3-none-any.whl .
47-
pip install tornasole-0.3-py2.py3-none-any.whl
46+
aws s3 sync s3://tornasole-binaries-use1/tornasole_tensorflow/py3/latest/ tornasole_tensorflow/
47+
pip install tornasole_tensorflow/*
4848
```
4949

5050
**Please note** : If, while installing tornasole, you get a version conflict issue between botocore and boto3,

0 commit comments

Comments
 (0)