-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
46 lines (38 loc) · 1.07 KB
/
server.py
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
import boto3
import json
client = boto3.client('ecs')
def run_task():
with open('frontend/src/constants/cdk.json', 'r') as f:
CDK_CONFIG = json.loads(f.read())['pictionary']
overrides = {
'containerOverrides': [
{
'name': CDK_CONFIG['container'],
'environment': [
{
'name': 'bucket',
'value': CDK_CONFIG['pictureBucket']
},
{
'name': 'queueUrl',
'value': CDK_CONFIG['queueUrl']
},
{
'name': 'region',
'value': CDK_CONFIG['region']
}
]
}
]
}
response = client.run_task(
cluster=CDK_CONFIG['clusterArn'],
taskDefinition=CDK_CONFIG['taskDefinitionArn'],
overrides=overrides
)
print(response)
def main():
for _ in range(3):
run_task()
if __name__ == '__main__':
main()