24
24
from sdcm .stress_thread import DockerBasedStressThread
25
25
from sdcm .utils .docker_remote import RemoteDocker
26
26
27
-
28
27
LOGGER = logging .getLogger (__name__ )
29
28
30
29
@@ -59,7 +58,6 @@ def run(self):
59
58
60
59
61
60
class GeminiStressThread (DockerBasedStressThread ): # pylint: disable=too-many-instance-attributes
62
-
63
61
DOCKER_IMAGE_PARAM_NAME = "stress_image.gemini"
64
62
65
63
def __init__ (self , test_cluster , oracle_cluster , loaders , stress_cmd , timeout = None , params = None ): # pylint: disable=too-many-arguments
@@ -105,9 +103,9 @@ def __init__(self, test_cluster, oracle_cluster, loaders, stress_cmd, timeout=No
105
103
self .gemini_result_file = f"gemini_result_{ self .unique_id } .log"
106
104
107
105
def _generate_gemini_command (self ):
108
- seed = self .params .get (' gemini_seed' ) or random .randint (1 , 100 )
109
- table_options = self .params .get (' gemini_table_options' )
110
- log_statements = self .params .get (' gemini_log_cql_statements' ) or False
106
+ seed = self .params .get (" gemini_seed" ) or random .randint (1 , 100 )
107
+ table_options = self .params .get (" gemini_table_options" )
108
+ log_statements = self .params .get (" gemini_log_cql_statements" ) or False
111
109
112
110
test_nodes = "," .join (self .test_cluster .get_node_cql_ips ())
113
111
oracle_nodes = "," .join (self .oracle_cluster .get_node_cql_ips ())
@@ -119,7 +117,7 @@ def _generate_gemini_command(self):
119
117
--seed={ seed } \
120
118
--schema-seed={ seed } \
121
119
--profiling-port=6060 \
122
- --bind=0.0.0.0:2121 \
120
+ --bind=0.0.0.0:2112 \
123
121
--outfile=/{ self .gemini_result_file } \
124
122
--replication-strategy=\" {{'class': 'NetworkTopologyStrategy', 'replication_factor': '3'}}\" \
125
123
--oracle-replication-strategy=\" {{'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}}\" "
@@ -130,16 +128,16 @@ def _generate_gemini_command(self):
130
128
131
129
credentials = self .loader_set .get_db_auth ()
132
130
133
- if credentials and ' --test-username' not in cmd :
131
+ if credentials and " --test-username" not in cmd :
134
132
cmd += f"--test-username={ credentials [0 ]} \
135
133
--test-password={ credentials [1 ]} \
136
134
--oracle-username={ credentials [0 ]} \
137
135
--oracle-password={ credentials [1 ]} "
138
136
139
137
if table_options :
140
- cmd += " " .join ([f" --table-options=\ "{ table_opt } \" " for table_opt in table_options ])
138
+ cmd += " " .join ([f' --table-options="{ table_opt } "' for table_opt in table_options ])
141
139
142
- stress_cmd = self .stress_cmd .replace (' \n ' , ' ' ).strip ()
140
+ stress_cmd = self .stress_cmd .replace (" \n " , " " ).strip ()
143
141
144
142
for key , value in self .gemini_default_flags .items ():
145
143
if not key in stress_cmd :
@@ -156,35 +154,35 @@ def _run_stress(self, loader, loader_idx, cpu_idx):
156
154
docker = cleanup_context = RemoteDocker (
157
155
loader ,
158
156
self .docker_image_name ,
159
- extra_docker_opts = f'--cpuset-cpus="{ cpu_idx } "' if self .stress_num > 1 else ""
160
- '--label shell_marker={self.shell_marker}'
161
- '--network=host '
162
- '--security-opt seccomp=unconfined '
157
+ extra_docker_opts = f'--cpuset-cpus="{ cpu_idx } " '
158
+ if self .stress_num > 1
159
+ else ""
160
+ "--network=host "
161
+ "--security-opt seccomp=unconfined "
163
162
'--entrypoint="" '
164
- f'-v $HOME/{ self .gemini_result_file } :/{ self .gemini_result_file } '
165
- f'-v $HOME/{ self .gemini_test_statements_file } :/{ self .gemini_test_statements_file } '
166
- f'-v $HOME/{ self .gemini_oracle_statements_file } :/{ self .gemini_oracle_statements_file } '
163
+ f"--label shell_marker={ self .shell_marker } "
164
+ f"-v $HOME/{ self .gemini_result_file } :/{ self .gemini_result_file } "
165
+ f"-v $HOME/{ self .gemini_test_statements_file } :/{ self .gemini_test_statements_file } "
166
+ f"-v $HOME/{ self .gemini_oracle_statements_file } :/{ self .gemini_oracle_statements_file } " ,
167
167
)
168
168
169
169
if not os .path .exists (loader .logdir ):
170
170
os .makedirs (loader .logdir , exist_ok = True )
171
- log_file_name = os .path .join (loader .logdir , 'gemini-l%s-c%s-%s.log' %
172
- (loader_idx , cpu_idx , uuid .uuid4 ()))
173
- LOGGER .debug ('gemini local log: %s' , log_file_name )
171
+ log_file_name = os .path .join (loader .logdir , "gemini-l%s-c%s-%s.log" % (loader_idx , cpu_idx , uuid .uuid4 ()))
172
+ LOGGER .debug ("gemini local log: %s" , log_file_name )
174
173
175
174
gemini_cmd = self ._generate_gemini_command ()
176
- with cleanup_context , \
177
- GeminiEventsPublisher (node = loader , gemini_log_filename = log_file_name ) as publisher , \
178
- GeminiStressEvent (node = loader , cmd = gemini_cmd , log_file_name = log_file_name ) as gemini_stress_event :
175
+ with cleanup_context , GeminiEventsPublisher (node = loader , gemini_log_filename = log_file_name ) as publisher , GeminiStressEvent (node = loader , cmd = gemini_cmd , log_file_name = log_file_name ) as gemini_stress_event :
179
176
try :
180
177
publisher .event_id = gemini_stress_event .event_id
181
178
gemini_stress_event .log_file_name = log_file_name
182
- result = docker .run (cmd = gemini_cmd ,
183
- timeout = self .timeout ,
184
- ignore_status = False ,
185
- log_file = log_file_name ,
186
- retry = 0 ,
187
- )
179
+ result = docker .run (
180
+ cmd = gemini_cmd ,
181
+ timeout = self .timeout ,
182
+ ignore_status = False ,
183
+ log_file = log_file_name ,
184
+ retry = 0 ,
185
+ )
188
186
# sleep to gather all latest log messages
189
187
time .sleep (5 )
190
188
except Exception as details : # pylint: disable=broad-except
@@ -227,34 +225,33 @@ def get_gemini_results(self):
227
225
228
226
@staticmethod
229
227
def verify_gemini_results (results ):
230
-
231
- stats = {'results' : [], 'errors' : {}}
228
+ stats = {"results" : [], "errors" : {}}
232
229
if not results :
233
- LOGGER .error (' Gemini results are not found' )
234
- stats [' status' ] = ' FAILED'
230
+ LOGGER .error (" Gemini results are not found" )
231
+ stats [" status" ] = " FAILED"
235
232
else :
236
233
for res in results :
237
- stats [' results' ].append (res )
238
- for err_type in [' write_errors' , ' read_errors' , ' errors' ]:
234
+ stats [" results" ].append (res )
235
+ for err_type in [" write_errors" , " read_errors" , " errors" ]:
239
236
if res .get (err_type , None ):
240
237
LOGGER .error ("Gemini {} errors: {}" .format (err_type , res [err_type ]))
241
- stats [' status' ] = ' FAILED'
242
- stats [' errors' ][err_type ] = res [err_type ]
243
- if not stats .get (' status' ):
244
- stats [' status' ] = "PASSED"
238
+ stats [" status" ] = " FAILED"
239
+ stats [" errors" ][err_type ] = res [err_type ]
240
+ if not stats .get (" status" ):
241
+ stats [" status" ] = "PASSED"
245
242
246
243
return stats
247
244
248
245
@staticmethod
249
246
def _parse_gemini_summary_json (json_str ):
250
- results = {' result' : {}}
247
+ results = {" result" : {}}
251
248
try :
252
249
results = json .loads (json_str )
253
250
254
251
except Exception as details : # pylint: disable=broad-except
255
252
LOGGER .error ("Invalid json document {}" .format (details ))
256
253
257
- return results .get (' result' )
254
+ return results .get (" result" )
258
255
259
256
@staticmethod
260
257
def _parse_gemini_summary (lines ):
@@ -263,7 +260,7 @@ def _parse_gemini_summary(lines):
263
260
264
261
for line in lines :
265
262
line .strip ()
266
- if ' Results:' in line :
263
+ if " Results:" in line :
267
264
enable_parse = True
268
265
continue
269
266
if "run completed" in line :
@@ -272,7 +269,7 @@ def _parse_gemini_summary(lines):
272
269
if not enable_parse :
273
270
continue
274
271
275
- split_idx = line .index (':' )
272
+ split_idx = line .index (":" )
276
273
key = line [:split_idx ].strip ()
277
274
value = line [split_idx + 1 :].split ()[0 ]
278
275
results [key ] = int (value )
0 commit comments