-
Notifications
You must be signed in to change notification settings - Fork 1
/
launch_all_scorecontainers.py
executable file
·29 lines (22 loc) · 1.14 KB
/
launch_all_scorecontainers.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
#!/usr/bin/env python
import tutum
import time, sys, argparse
parser = argparse.ArgumentParser(description='Launch scorecontainers on all the nodes having the given tag')
parser.add_argument('-t', dest='tag', metavar='tag', help='tag indicated which nodes to launch on', required=True)
args = parser.parse_args()
def msg(str):
print "%s %s" % (time.strftime('%Y%m%d-%H%M%S'), str)
SCORESERVERS_PER_CONTAINER = 32
envvars = []
envvars.append({"key": "NUM_SCORESERVERS", "value": str(SCORESERVERS_PER_CONTAINER)})
envvars.append({"key": "DEBUG", "value": "1"})
envvars.append({"key": "MIN_ITEMS_PER_KEY", "value": "200000"})
envvars.append({"key": "MOVETIME", "value": "2000"})
envvars.append({"key": "THREADS", "value": "1"})
envvars.append({"key": "HASH", "value": "1000"})
msg("Launching all scorecontainers on tag %s" % args.tag)
servicename = "scorecontainer%s" % (time.strftime('%Y%m%d-%H%M%S'))
service = tutum.Service.create(image="tutum.co/dsjoerg/scoreserver", name=servicename, container_envvars=envvars, deployment_strategy='EVERY_NODE', tags=[{'name': args.tag}])
service.save()
service.start()
msg("Done. Service uuid = %s" % service.uuid)