forked from Marie-Donnie/juice
-
Notifications
You must be signed in to change notification settings - Fork 1
/
experiments.py
executable file
·168 lines (143 loc) · 5.54 KB
/
experiments.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
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
#!/usr/bin/env python
import copy
import logging
import os
from pprint import pformat
import juice as j
from execo_engine.sweep import (ParamSweeper, sweep)
SWEEPER_DIR = os.path.join(os.getenv('HOME'), 'juice-sweeper')
JOB_NAME = 'juice-tests-mercredi'
# WALLTIME = '08:18:00'
# WALLTIME = '44:55:00'
WALLTIME = '13:59:58'
RESERVATION = None
# RESERVATION = '2018-03-21 01:15:00'
# DATABASES = ['cockroachdb']
DATABASES = ['mariadb', 'cockroachdb']
CLUSTER_SIZES = [45]
# CLUSTER_SIZES = [3, 25, 45, 100]
DELAYS = [0, 50, 150]
# DELAYS = [0]
CLUSTER = 'ecotype'
SITE = 'nantes'
MAX_CLUSTER_SIZE = max(CLUSTER_SIZES)
CONF = {
'monitoring': True,
'g5k': {'dhcp': True,
'env_name': 'debian9-x64-nfs',
'job_name': JOB_NAME,
# 'queue': 'testing',
'walltime': WALLTIME,
'reservation': RESERVATION,
'resources': {'machines': [{'cluster': CLUSTER,
'nodes': MAX_CLUSTER_SIZE,
'roles': ['chrony',
'database',
'sysbench',
'openstack',
'rally'],
'primary_network': 'n1',
'secondary_networks': ['n2']},
{'cluster': CLUSTER,
'nodes': 1,
'roles': ['registry', 'control'],
'primary_network': 'n1',
'secondary_networks': []}],
'networks': [{'id': 'n1',
'roles': ['control_network'],
'site': SITE,
'type': 'prod'},
{'id': 'n2',
'roles': ['database_network'],
'site': SITE,
'type': 'kavlan'},
]}},
'registry': {'ceph': True,
'ceph_id': 'discovery',
'ceph_keyring': '/home/discovery/.ceph/ceph.client.discovery.keyring',
'ceph_mon_host': ['ceph0.rennes.grid5000.fr',
'ceph1.rennes.grid5000.fr',
'ceph2.rennes.grid5000.fr'],
'ceph_rbd': 'discovery_kolla_registry/datas',
'type': 'none'},
'tc': {'constraints': [{'delay': '0ms',
'src': 'database',
'dst': 'database',
'loss': 0,
'rate': '10gbit',
"network": "database_network"}],
'default_delay': '0ms',
'default_rate': '10gbit',
'enable': True,
'groups': ['database']}
}
SCENARIOS = [
"keystone/authenticate-user-and-validate-token.yaml"
, "keystone/create-add-and-list-user-roles.yaml"
, "keystone/create-and-list-tenants.yaml"
, "keystone/get-entities.yaml"
, "keystone/create-user-update-password.yaml"
, "keystone/create-user-set-enabled-and-delete.yaml"
, "keystone/create-and-list-users.yaml"
]
logging.basicConfig(level=logging.INFO)
def init():
try:
j.g5k(config=CONF)
j.inventory()
j.destroy()
j.emulate(CONF['tc'])
except Exception as e:
logging.error(
"Setup goes wrong. This is not necessarily a bad news, "
"in particular, if it is the first time you run the "
"experiment: %s" % e)
def teardown():
try:
j.destroy()
j.emulate(CONF['tc'])
except Exception as e:
logging.warning(
"Setup went wrong. This is not necessarily a bad news, "
"in particular, if it is the first time you run the "
"experiment: %s" % e)
def keystone_exp():
sweeper = ParamSweeper(
SWEEPER_DIR,
sweeps=sweep({
'db': DATABASES
, 'delay': DELAYS
, 'db-nodes': CLUSTER_SIZES
}))
while sweeper.get_remaining():
combination = sweeper.get_next()
logging.info("Treating combination %s" % pformat(combination))
try:
# Setup parameters
conf = copy.deepcopy(CONF) # Make a deepcopy so we can run
# multiple sweeps in parallels
conf['g5k']['resources']['machines'][0]['nodes'] = combination['db-nodes']
conf['tc']['constraints'][0]['delay'] = "%sms" % combination['delay']
db = combination['db']
xp_name = "%s-%s-%s" % (db, combination['db-nodes'], combination['delay'])
# Let's get it started hun!
j.deploy(conf, db, xp_name)
j.openstack(db)
j.emulate(conf['tc'])
j.rally(SCENARIOS, "keystone", burst=False)
j.backup()
# Everything works well, mark combination as done
sweeper.done(combination)
logging.info("End of combination %s" % pformat(combination))
except Exception as e:
# Oh no, something goes wrong! Mark combination as cancel for
# a later retry
logging.error("Combination %s Failed with message %s" % (pformat(combination), e))
sweeper.cancel(combination)
finally:
teardown()
if __name__ == '__main__':
# Do the initial reservation and boilerplate
init()
# Run experiment
keystone_exp()