forked from finos/htc-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
258 lines (185 loc) · 8.33 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# Copyright 2024 Amazon.com, Inc. or its affiliates.
# SPDX-License-Identifier: Apache-2.0
# Licensed under the Apache License, Version 2.0 https://aws.amazon.com/apache-2-0/
export TAG=mainline
export ACCOUNT_ID=$(shell aws sts get-caller-identity | jq -r '.Account')
export REGION=eu-west-1
export LAMBDA_INIT_IMAGE_NAME=lambda-init
export LAMBDA_AGENT_IMAGE_NAME=awshpc-lambda
export SUBMITTER_IMAGE_NAME=submitter
export GENERATED=$(shell pwd)/generated
export BUCKET_NAME
export FILE_HANDLER
export FUNCTION_HANDLER
export DIST_DIR=$(shell pwd)/dist
export REBUILD_RUNTIMES
export GRAFANA_ADMIN_PASSWORD
export BUILD_DIR:=(shell pwd)/.build
BUILD_TYPE?=Release
PACKAGE_DIR := ./dist
PYTHON_PACKAGE_DIR := ./dist/python
PACKAGES := $(wildcard $(PYTHON_PACKAGE_DIR)/*.whl)
.PHONY: all utils api lambda submitter packages test test-api test-utils test-agent lambda-init config-c++
all: utils api lambda submitter lambda-init k8s-jobs
##################################################
#### Log in to the different docker registry #####
##################################################
ecr-login:
aws ecr get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(ACCOUNT_ID).dkr.ecr.$(REGION).amazonaws.com
public-ecr-login:
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
docker-registry-login: ecr-login public-ecr-login
###############################################
####### Manage HTC Grid states ########
###############################################
init-grid-state: ./deployment/init_grid/cloudformation
$(MAKE) -C $< init
$(MAKE) -C $<
delete-grid-state: ./deployment/init_grid/cloudformation
$(MAKE) -C $< delete
clean-grid-state: ./deployment/init_grid/cloudformation
$(MAKE) -C $< clean
###########################################################################################
#### Manage CDK/Terraform images transfer from third parties to given docker registry ####
###########################################################################################
init-images : ./deployment/image_repository/terraform
@$(MAKE) -C $< init
reset-images-deployment: ./deployment/image_repository/terraform
@$(MAKE) -C $< reset
transfer-images: ./deployment/image_repository/terraform
@$(MAKE) -C $< apply
auto-transfer-images: ./deployment/image_repository/terraform
@$(MAKE) -C $< auto-apply
destroy-images: ./deployment/image_repository/terraform
@$(MAKE) -C $< destroy
auto-destroy-images: ./deployment/image_repository/terraform
@$(MAKE) -C $< auto-destroy
###############################################
#### Manage HTC Grid Terraform deployment ####
###############################################
init-grid-deployment: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/grid_config.json init
reset-grid-deployment: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/grid_config.json reset
###########################################
##### Custom runtime (C++) with Redis #####
###########################################
# deploy runtime with confirmation
apply-custom-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/grid_config.json apply
# deploy runtime without confirmation
auto-apply-custom-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/grid_config.json auto-apply
# destroy runtime with confirmation
destroy-custom-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/grid_config.json destroy
# destroy runtime without confirmation
auto-destroy-custom-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/grid_config.json auto-destroy
########################################
##### Custom runtime (C++) with S3 #####
########################################
# deploy runtime with confirmation
apply-custom-runtime-s3: ./deployment/grid/terraform
@$(MAKE) -C $< ./deployment/grid/terraform GRID_CONFIG=$(GENERATED)/custom_runtime_s3_grid_config.json apply
# deploy runtime without confirmation
auto-apply-custom-runtime-s3: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/custom_runtime_s3_grid_config.json auto-apply
# destroy runtime with confirmation
destroy-custom-runtime-s3: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/custom_runtime_s3_grid_config.json destroy
# destroy runtime without confirmation
auto-destroy-custom-runtime-s3: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/custom_runtime_s3_grid_config.json auto-destroy
##################################################
##### Python runtime targets (Python, Redis) #####
##################################################
# deploy runtime with confirmation
apply-python-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/python_runtime_grid_config.json apply
# deploy runtime without confirmation
auto-apply-python-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/python_runtime_grid_config.json auto-apply
# destroy runtime with confirmation
destroy-python-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/python_runtime_grid_config.json destroy
# destroy runtime without confirmation
auto-destroy-python-runtime: ./deployment/grid/terraform
@$(MAKE) -C $< GRID_CONFIG=$(GENERATED)/python_runtime_grid_config.json auto-destroy
##########################################################
#### Retrieve output value from terraform deployment #####
##########################################################
get-grafana-password: ./deployment/grid/terraform
@$(MAKE) --no-print-directory -C $< get-grafana-password
get-userpool-id: ./deployment/grid/terraform
@$(MAKE) --no-print-directory -C $< get-userpool-id
get-client-id: ./deployment/grid/terraform
@$(MAKE) --no-print-directory -C $< get-client-id
get-agent-configuration: ./deployment/grid/terraform
@$(MAKE) --no-print-directory -C $< get-agent-configuration
#############################
##### Building source #######
#############################
http-apis:
$(MAKE) -C ./source/control_plane/openapi/ all
utils:
$(MAKE) -C ./source/client/python/utils
install-utils: utils
pip install --force-reinstall $(PYTHON_PACKAGE_DIR)/utils-*.whl
test-utils:
$(MAKE) test -C ./source/client/python/utils
api: http-apis
$(MAKE) -C ./source/client/python/api-v0.1
test-api: install-utils
$(MAKE) test -C ./source/client/python/api-v0.1
test-agent:
$(MAKE) test -C ./source/compute_plane/python/agent
packages: api utils
test-packages: test-api test-utils
test: test-agent test-packages
#############################
##### Building images #######
#############################
lambda: utils api
$(MAKE) -C ./source/compute_plane/python/agent
lambda-init: utils api
$(MAKE) -C ./source/compute_plane/shell/attach-layer all
python-submitter: utils api
$(MAKE) -C ./examples/client/python
####################################
##### Building documentation #######
####################################
doc: import
mkdocs build
serve: import
mkdocs serve
import: packages $(PACKAGES)
pip install --force-reinstall $(PACKAGES)
######################################
##### Upload workload binaries #######
######################################
upload-c++: config-c++
$(MAKE) -C ./examples/workloads/c++/mock_computation upload
upload-python: config-python
$(MAKE) -C ./examples/workloads/python/mock_computation upload
upload-python-ql: config-python
$(MAKE) -C ./examples/workloads/python/quant_lib upload
config-c++:
@$(MAKE) -C ./examples/configurations generated-c++
config-python:
@$(MAKE) -C ./examples/configurations generated-python FILE_HANDLER="mock_compute_engine.lambda_handler" FUNCTION_HANDLER=lambda_handler
config-python-ql:
@$(MAKE) -C ./examples/configurations generated-python FILE_HANDLER="portfolio_pricing_engine.lambda_handler" FUNCTION_HANDLER=lambda_handler
config-s3-c++:
@$(MAKE) -C ./examples/configurations generated-s3-c++
###############################
##### Generate k8s jobs #######
###############################
k8s-jobs:
@$(MAKE) -C ./examples/submissions/k8s_jobs
#############################
##### Path per example ######
#############################
happy-path: ecr-login all upload-c++ config-c++
python-happy-path: ecr-login all upload-python config-python
python-quant-lib-path: ecr-login all upload-python-ql config-python-ql