-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathMakefile
129 lines (105 loc) · 5.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# MIT License
#
# Copyright (c) 2021 Dmitrii Ustiugov and EASE lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
ROOT = ../../
HERE = ./benchmarks/map-reduce
PLATFORM = --platform linux/amd64
MODE = --load
export AWS_REGION := ${AWS_REGION}
export AWS_ACCESS_KEY := ${AWS_ACCESS_KEY}
export AWS_SECRET_KEY := ${AWS_SECRET_KEY}
export AWS_ACCOUNT_ID := ${AWS_ACCOUNT_ID}
# For debugging on Apple M1 below
#PLATFORM = --platform linux/arm64
#MODE = --push
.PHONY: proto
all: all-image all-image-lambda
all-image: driver-image mapper-image reducer-image
all-image-lambda: driver-image-lambda mapper-image-lambda reducer-image-lambda
all-push: all-image-push all-image-lambda-push
all-image-push: driver-image-push mapper-image-push reducer-image-push
all-image-lambda-push: driver-image-lambda-push mapper-image-lambda-push reducer-image-lambda-push
driver-image: docker/Dockerfile proto/mapreduce_pb2_grpc.py proto/mapreduce_pb2.py driver/main.py
docker buildx build $(PLATFORM) \
-t vhiveease/mapreduce-driver:latest \
--build-arg target_arg=driver \
--secret id=GOPRIVATE_KEY \
-f docker/Dockerfile \
$(ROOT) $(MODE)
mapper-image: docker/Dockerfile proto/mapreduce_pb2_grpc.py proto/mapreduce_pb2.py mapper/main.py
docker buildx build $(PLATFORM) \
-t vhiveease/mapreduce-mapper:latest \
--build-arg target_arg=mapper \
--secret id=GOPRIVATE_KEY \
-f docker/Dockerfile \
$(ROOT) $(MODE)
reducer-image: docker/Dockerfile proto/mapreduce_pb2_grpc.py proto/mapreduce_pb2.py reducer/main.py
docker buildx build $(PLATFORM) \
-t vhiveease/mapreduce-reducer:latest \
--build-arg target_arg=reducer \
--secret id=GOPRIVATE_KEY \
-f docker/Dockerfile \
$(ROOT) $(MODE)
driver-image-lambda: docker/Dockerfile.Lambda driver/main.py
docker buildx build $(PLATFORM) \
-t $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/mapreduce-driver-lambda:latest \
--build-arg target_arg=driver \
-f docker/Dockerfile.Lambda \
$(ROOT) $(MODE)
mapper-image-lambda: docker/Dockerfile.Lambda mapper/main.py
docker buildx build $(PLATFORM) \
-t $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/mapreduce-mapper-lambda:latest \
--build-arg target_arg=mapper \
-f docker/Dockerfile.Lambda \
$(ROOT) $(MODE)
reducer-image-lambda: docker/Dockerfile.Lambda reducer/main.py
docker buildx build $(PLATFORM) \
-t $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/mapreduce-reducer-lambda:latest \
--build-arg target_arg=reducer \
-f docker/Dockerfile.Lambda \
$(ROOT) $(MODE)
driver-image-push: driver-image
docker push vhiveease/mapreduce-driver:latest
mapper-image-push: mapper-image
docker push vhiveease/mapreduce-mapper:latest
reducer-image-push: reducer-image
docker push vhiveease/mapreduce-reducer:latest
driver-image-lambda-push: driver-image-lambda
aws ecr get-login-password --region $(AWS_REGION) | \
docker login --username AWS --password-stdin \
$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
python $(ROOT)/runner/aws_lambda_scripts/aws_actions.py create_ecr_repo -n mapreduce-driver-lambda
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/mapreduce-driver-lambda:latest
mapper-image-lambda-push: mapper-image-lambda
aws ecr get-login-password --region $(AWS_REGION) | \
docker login --username AWS --password-stdin \
$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
python $(ROOT)/runner/aws_lambda_scripts/aws_actions.py create_ecr_repo -n mapreduce-mapper-lambda
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/mapreduce-mapper-lambda:latest
reducer-image-lambda-push: reducer-image-lambda
aws ecr get-login-password --region $(AWS_REGION) | \
docker login --username AWS --password-stdin \
$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
python $(ROOT)/runner/aws_lambda_scripts/aws_actions.py create_ecr_repo -n mapreduce-reducer-lambda
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/mapreduce-reducer-lambda:latest
proto: proto/mapreduce.proto proto/helloworld.proto
python -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/mapreduce.proto
python -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/helloworld.proto