benchmark-runner 1.0.787__py3-none-any.whl → 1.0.789__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of benchmark-runner might be problematic. Click here for more details.

@@ -90,6 +90,8 @@ class EnvironmentVariables:
90
90
  self._environment_variables_dict['run_strategy'] = EnvironmentVariables.get_boolean_from_environment('RUN_STRATEGY', False)
91
91
  # Verification only, without running or deleting any resources, default False
92
92
  self._environment_variables_dict['verification_only'] = EnvironmentVariables.get_boolean_from_environment('VERIFICATION_ONLY', False)
93
+ # verify after test
94
+ self._environment_variables_dict['verify_after_test'] = EnvironmentVariables.get_env('VERIFY_AFTER_TEST', '')
93
95
 
94
96
  # default parameter - change only if needed
95
97
  # Parameters below related to 'run_workload()'
@@ -1,7 +1,7 @@
1
1
 
2
2
  import os
3
3
  import time
4
- from multiprocessing import Process
4
+ from multiprocessing import Process, Manager
5
5
 
6
6
  from benchmark_runner.common.logger.logger_time_stamp import logger_time_stamp, logger
7
7
  from benchmark_runner.common.elasticsearch.elasticsearch_exceptions import ElasticSearchDataNotUploaded
@@ -162,7 +162,7 @@ class BootstormVM(WorkloadsOperations):
162
162
  try:
163
163
  virtctl_status = self._oc.get_virtctl_vm_status(vm_name)
164
164
 
165
- if virtctl_status == "True":
165
+ if str(virtctl_status).lower() == "true":
166
166
  # Log success and store relevant data
167
167
  logger.info(f"VM {vm_name} verified successfully (virtctl SSH status: { virtctl_status}).")
168
168
  break # Exit loop on success
@@ -173,22 +173,25 @@ class BootstormVM(WorkloadsOperations):
173
173
  logger.info(f"Attempt {attempt + 1}/{retries} failed for Virtctl SSH VM {vm_name}: {e}")
174
174
 
175
175
  # Sleep before retrying
176
- time.sleep(delay)
176
+ if attempt < retries - 1:
177
+ time.sleep(delay)
178
+
177
179
 
178
180
  # Final update to self._data_dict after all attempts
179
181
  vm_node = self._oc.get_vm_node(vm_name) # Get the node again in case it changed
180
182
  self._data_dict = {
181
183
  'vm_name': vm_name,
182
184
  'node': vm_node,
183
- 'virtctl_vm': 1 if virtctl_status == 'True' else 0, # int value for Grafana
185
+ 'virtctl_vm': 1 if str(virtctl_status).lower() == "true" else 0, # int value for Grafana
184
186
  'virtctl_status': virtctl_status,
187
+ 'verify_after_test': self._verify_after_test,
185
188
  'run_artifacts_url': os.path.join(
186
189
  self._run_artifacts_url,
187
190
  f"{self._get_run_artifacts_hierarchy(self._workload_name, True)}-{self._time_stamp_format}.tar.gz"
188
191
  )
189
192
  }
190
193
 
191
- if virtctl_status != "True":
194
+ if str(virtctl_status).lower() != "true":
192
195
  logger.info(
193
196
  f"All attempts failed for VM {vm_name}. Final SSH status: {self._data_dict.get('virtctl_status', 'No status available')}")
194
197
  error_log_path = f"{self._run_artifacts_path}/{vm_name}_error.log"
@@ -196,76 +199,109 @@ class BootstormVM(WorkloadsOperations):
196
199
  # Retrieve the status or use a default message
197
200
  status_message = self._data_dict.get('virtctl_status') or "No status available"
198
201
 
199
- with open(error_log_path, "w") as error_log_file:
200
- error_log_file.write(str(status_message)) # Convert to string just in case
202
+ try:
203
+ with open(error_log_path, "w") as error_log_file:
204
+ error_log_file.write(str(status_message))
205
+ except Exception as write_err:
206
+ logger.error(f"Failed to write error log for {vm_name}: {write_err}")
201
207
 
202
208
  self._finalize_vm()
203
209
  return virtctl_status
204
210
 
205
- def _verify_virtctl_vm(self):
211
+ def _verify_single_vm_wrapper(self, vm_name, return_dict):
206
212
  """
207
- This method verifies the virtctl SSH login for each VM, either during the upgrade or once for each VM.
208
- It prepares the data for ElasticSearch, generates a must-gather in case of an error, and uploads it to Google Drive.
213
+ This method verifies single vm and update vm status in return_dict
214
+ :param vm_name:
215
+ :param return_dict:
216
+ :return:
209
217
  """
210
- try:
211
- vm_names = self._oc._get_all_vm_names()
212
- if not vm_names:
213
- raise MissingVMs("No VM names were retrieved from the cluster.")
214
-
215
- upgrade_done = True
216
- failure = False
217
- failure_vms = [] # List to store failed VM names
218
-
219
- if self._wait_for_upgrade_version:
220
- logger.info(f"wait for ocp upgrade version: {self._wait_for_upgrade_version}")
221
- upgrade_done = self._oc.get_cluster_status() == f'Cluster version is {self._wait_for_upgrade_version}'
222
- current_wait_time = 0
223
-
224
- while (self._timeout <= 0 or current_wait_time <= self._timeout) and not upgrade_done:
225
- for vm_name in vm_names:
226
- virtctl_status = self._verify_single_vm(vm_name)
227
- if virtctl_status != 'True':
228
- failure = True
229
- if vm_name not in failure_vms:
230
- failure_vms.append(vm_name)
218
+ status = self._verify_single_vm(vm_name)
219
+ return_dict[vm_name] = status
220
+
221
+ def _verify_vms_in_parallel(self, vm_names):
222
+ """
223
+ This method verifies vms in parallel
224
+ :param vm_names:
225
+ :return:
226
+ """
227
+ failure_vms = []
228
+ manager = Manager()
229
+ return_dict = manager.dict()
230
+
231
+ # Split vm_names according to self._threads_limit
232
+ for i in range(0, len(vm_names), self._threads_limit):
233
+ bulk = vm_names[i:i + self._threads_limit]
234
+ processes = []
235
+
236
+ for vm_name in bulk:
237
+ p = Process(target=self._verify_single_vm_wrapper, args=(vm_name, return_dict))
238
+ p.start()
239
+ processes.append(p)
240
+
241
+ for p in processes:
242
+ p.join()
243
+
244
+ # After all processes are done, collect failures
245
+ for vm_name, status in return_dict.items():
246
+ if str(status).lower() != 'true':
247
+ failure_vms.append(vm_name)
248
+ return failure_vms
249
+
250
+ def _verify_virtctl_vms(self, delay=10):
251
+ """
252
+ This method verifies the virtctl SSH login for each VM, either during the upgrade or once for each VM.
253
+ It prepares the data for ElasticSearch, generates a must-gather in case of an error, and uploads it to Google Drive.
254
+ :param delay: delay between each iteration
255
+ """
256
+ try:
257
+ vm_names = self._oc._get_all_vm_names()
258
+ if not vm_names:
259
+ raise MissingVMs("No VM names were retrieved from the cluster.")
260
+
261
+ upgrade_done = True
262
+ failure_vms = [] # List to store failed VM names
263
+
264
+ if self._wait_for_upgrade_version:
265
+ logger.info(f"wait for ocp upgrade version: {self._wait_for_upgrade_version}")
231
266
  upgrade_done = self._oc.get_cluster_status() == f'Cluster version is {self._wait_for_upgrade_version}'
267
+ start_time = time.time()
232
268
 
233
- # Sleep 1 sec between each cycle
234
- time.sleep(1)
235
- current_wait_time += 1 # Increment the wait time
236
- else:
237
- # If _wait_for_upgrade_version is empty, verify VM SSH without waiting for upgrade
238
- for vm_name in vm_names:
239
- virtctl_status = self._verify_single_vm(vm_name)
240
- if virtctl_status != 'True':
241
- failure = True
242
- if vm_name not in failure_vms:
243
- failure_vms.append(vm_name)
244
-
245
- if self._wait_for_upgrade_version:
246
- logger.info(f'Cluster is upgraded to: {self._wait_for_upgrade_version}')
247
-
248
- if failure:
249
- self._oc.generate_cnv_must_gather(destination_path=self._run_artifacts_path,
250
- cnv_version=self._cnv_version)
251
- self._oc.generate_odf_must_gather(destination_path=self._run_artifacts_path,
252
- odf_version=self._odf_version)
253
- # Upload artifacts
254
- if self._google_drive_shared_drive_id:
255
- self.upload_run_artifacts_to_google_drive()
256
- elif self._endpoint_url and not self._google_drive_shared_drive_id:
257
- self.upload_run_artifacts_to_s3()
258
- else:
259
- self._save_artifacts_local = True
269
+ while (self._timeout <= 0 or time.time() - start_time <= self._timeout) and not upgrade_done:
270
+ failure_vms = self._verify_vms_in_parallel(vm_names)
271
+ upgrade_done = self._oc.get_cluster_status() == f'Cluster version is {self._wait_for_upgrade_version}'
260
272
 
261
- # Error log with details of failed VM, for catching all vm errors
262
- logger.error(
263
- f"Failed to verify virtctl SSH login for the following VMs: {', '.join(failure_vms)}")
273
+ if upgrade_done:
274
+ break
264
275
 
265
- except Exception as err:
266
- # Save run artifacts logs
267
- self.save_error_logs()
268
- raise err
276
+ # Sleep between each cycle
277
+ time.sleep(delay)
278
+ else:
279
+ failure_vms = self._verify_vms_in_parallel(vm_names)
280
+
281
+ if self._wait_for_upgrade_version:
282
+ logger.info(f'Cluster is upgraded to: {self._wait_for_upgrade_version}')
283
+
284
+ if failure_vms:
285
+ self._oc.generate_cnv_must_gather(destination_path=self._run_artifacts_path,
286
+ cnv_version=self._cnv_version)
287
+ self._oc.generate_odf_must_gather(destination_path=self._run_artifacts_path,
288
+ odf_version=self._odf_version)
289
+ # Upload artifacts
290
+ if self._google_drive_shared_drive_id:
291
+ self.upload_run_artifacts_to_google_drive()
292
+ elif self._endpoint_url and not self._google_drive_shared_drive_id:
293
+ self.upload_run_artifacts_to_s3()
294
+ else:
295
+ self._save_artifacts_local = True
296
+
297
+ # Error log with details of failed VM, for catching all vm errors
298
+ logger.error(
299
+ f"Failed to verify virtctl SSH login for the following VMs: {', '.join(failure_vms)}")
300
+
301
+ except Exception as err:
302
+ # Save run artifacts logs
303
+ self.save_error_logs()
304
+ raise err
269
305
 
270
306
  def _run_vm_scale(self, vm_num: str):
271
307
  """
@@ -349,7 +385,7 @@ class BootstormVM(WorkloadsOperations):
349
385
  def run_vm_workload(self):
350
386
  # verification only w/o running or deleting any resource
351
387
  if self._verification_only:
352
- self._verify_virtctl_vm()
388
+ self._verify_virtctl_vms()
353
389
  else:
354
390
  if not self._scale:
355
391
  self._run_vm()
@@ -17,7 +17,7 @@ from benchmark_runner.common.clouds.shared.s3.s3_operations import S3Operations
17
17
  from benchmark_runner.common.prometheus.prometheus_snapshot import PrometheusSnapshot
18
18
  from benchmark_runner.common.prometheus.prometheus_snapshot_exceptions import PrometheusSnapshotError
19
19
  from benchmark_runner.common.template_operations.template_operations import TemplateOperations
20
- from benchmark_runner.common.clouds.IBM.ibm_operations import IBMOperations
20
+ from benchmark_runner.common.clouds.BareMetal.bare_metal_operations import BareMetalOperations
21
21
  from benchmark_runner.common.prometheus.prometheus_metrics_operations import PrometheusMetricsOperation
22
22
  from benchmark_runner.common.google_drive.google_drive_operations import GoogleDriveOperations
23
23
 
@@ -103,6 +103,7 @@ class WorkloadsOperations:
103
103
  self._windows_url = self._environment_variables_dict.get('windows_url', '')
104
104
  self._delete_all = self._environment_variables_dict.get('delete_all', '')
105
105
  self._verification_only = self._environment_variables_dict.get('verification_only', '')
106
+ self._verify_after_test = self._environment_variables_dict.get('verify_after_test', '')
106
107
  self._wait_for_upgrade_version = self._environment_variables_dict.get('wait_for_upgrade_version', '')
107
108
  if self._windows_url:
108
109
  file_name = os.path.basename(self._windows_url)
@@ -390,7 +391,7 @@ class WorkloadsOperations:
390
391
  """
391
392
  date_format = '%Y_%m_%d'
392
393
  metadata = {'ocp_version': self._oc.get_ocp_server_version(),
393
- 'previous_ocp_version': self._oc.get_previous_ocp_version() if self._upgrade_ocp_version else '',
394
+ 'previous_ocp_version': '' if len(self._oc.get_previous_ocp_version()) > 10 else self._oc.get_previous_ocp_version(),
394
395
  'cnv_version': self._oc.get_cnv_version(),
395
396
  'kata_version': self._oc.get_kata_operator_version(),
396
397
  'kata_rpm_version': self._oc.get_kata_rpm_version(node=self._pin_node1),
@@ -455,15 +456,15 @@ class WorkloadsOperations:
455
456
  """
456
457
  if self._run_type == 'test_ci':
457
458
  es_index = 'ci-status-test'
459
+ elif self._run_type == 'chaos_ci':
460
+ es_index = 'ci-status-chaos'
458
461
  else:
459
462
  es_index = 'ci-status'
460
463
  status_dict = {'failed': 0, 'pass': 1}
461
464
  metadata = self.__get_metadata()
462
465
  if ocp_resource_install_minutes_time != 0:
463
- ibm_operations = IBMOperations(user=self._environment_variables_dict.get('provision_user', ''))
464
- ibm_operations.ibm_connect()
465
- ocp_install_minutes_time = ibm_operations.get_ocp_install_time()
466
- ibm_operations.ibm_disconnect()
466
+ bm_operations = BareMetalOperations(user=self._environment_variables_dict.get('provision_user', ''))
467
+ ocp_install_minutes_time = bm_operations.get_ocp_install_time()
467
468
  metadata.update({'status': status, 'status#': status_dict[status], 'ci_minutes_time': ci_minutes_time, 'benchmark_runner_id': benchmark_runner_id, 'benchmark_operator_id': benchmark_operator_id, 'benchmark_wrapper_id': benchmark_wrapper_id, 'ocp_install_minutes_time': ocp_install_minutes_time, 'ocp_resource_install_minutes_time': ocp_resource_install_minutes_time})
468
469
  self._es_operations.upload_to_elasticsearch(index=es_index, data=metadata)
469
470
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchmark-runner
3
- Version: 1.0.787
3
+ Version: 1.0.789
4
4
  Summary: Benchmark Runner Tool
5
5
  Home-page: https://github.com/redhat-performance/benchmark-runner
6
6
  Author: Red Hat
@@ -161,20 +161,20 @@ benchmark_runner/krkn_hub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
161
161
  benchmark_runner/krkn_hub/krknhub_exceptions.py,sha256=Hk7Co6zZ0u2RSmBmS4ZAi21ffZaQ2ITTfl6tGLtiAdY,180
162
162
  benchmark_runner/krkn_hub/krknhub_workloads.py,sha256=vUEw5y1rkhspxPdRFTHF_jKo1XwVphtkL-oSQQULVyI,3032
163
163
  benchmark_runner/main/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
164
- benchmark_runner/main/environment_variables.py,sha256=4kJx_e6vrI4ThBvIiCEkvmwbSfQit2EuUHiKmVllYe8,28356
164
+ benchmark_runner/main/environment_variables.py,sha256=ebp3VjLHzeprjZbhs8rGOHASfW3nKK-7BR-J7yBOYFg,28502
165
165
  benchmark_runner/main/environment_variables_exceptions.py,sha256=UR0Ith0P0oshsDZdJRlRq8ZUTt0h8jFvUtrnP4m4AIY,437
166
166
  benchmark_runner/main/main.py,sha256=A744O550wQh37hhk10H0HlT28LZ_2EOaRlJyWG6Pras,14083
167
167
  benchmark_runner/main/temporary_environment_variables.py,sha256=ODSHkfhgvdr_b2e3XyvykW21MVjSdyqimREyMc2klRE,957
168
168
  benchmark_runner/workloads/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
169
- benchmark_runner/workloads/bootstorm_vm.py,sha256=04hjGxfDcqpkJcarz-u56GqkrErQMUBC0c0vDQWn0h8,18754
169
+ benchmark_runner/workloads/bootstorm_vm.py,sha256=C0V4hfWSW_-kXLkC3MeW_Ie5myLfhDk3myu-e8eGhNs,19900
170
170
  benchmark_runner/workloads/vdbench_pod.py,sha256=OcmxVr5QlbkhAgY37wsZ7xJUjs9HI-qMVDex1HdL2P0,9778
171
171
  benchmark_runner/workloads/vdbench_vm.py,sha256=Yhoz-GbvZwA8q6qGIeSUsYhEIERj8SmJB1yjetwsGow,9449
172
172
  benchmark_runner/workloads/windows_vm.py,sha256=qFVD3qBFMnVpYXnrpam-7H5-0Yzvx6qtaEEZx4T-ex4,2415
173
173
  benchmark_runner/workloads/workloads.py,sha256=F9fnk4h715tq7ANSCbDH0jktB8fpr_u3YG61Kdi5_os,1422
174
174
  benchmark_runner/workloads/workloads_exceptions.py,sha256=u7VII95iPRF_YhfpGH1U1RmgiIYESMOtbSF1dz7_ToE,1858
175
- benchmark_runner/workloads/workloads_operations.py,sha256=EEIZjNYGjEkyUafxFKSu4X9jaN_wgYDbMeCi1hZBZ-0,25186
176
- benchmark_runner-1.0.787.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
177
- benchmark_runner-1.0.787.dist-info/METADATA,sha256=bsMnUcGVMnQTr5F5Uqf2drMDe5VgSKiozbvu585JRLA,11520
178
- benchmark_runner-1.0.787.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
179
- benchmark_runner-1.0.787.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
180
- benchmark_runner-1.0.787.dist-info/RECORD,,
175
+ benchmark_runner/workloads/workloads_operations.py,sha256=nHwy61d-CyyW03HsgPJZ73SKuq2rY0aLaRL6R4V0eLc,25324
176
+ benchmark_runner-1.0.789.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
177
+ benchmark_runner-1.0.789.dist-info/METADATA,sha256=WliGrtbb6nGLtemvwvmitKavx6ywUJjCowiKrHFJ_mg,11520
178
+ benchmark_runner-1.0.789.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
179
+ benchmark_runner-1.0.789.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
180
+ benchmark_runner-1.0.789.dist-info/RECORD,,