benchmark-runner 1.0.748__py3-none-any.whl → 1.0.750__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.

@@ -31,6 +31,8 @@ class OC(SSH):
31
31
  SHORT_TIMEOUT = 600
32
32
  # sleep time between checks is 5 sec
33
33
  SLEEP_TIME = 3
34
+ RETRIES = 10
35
+ DELAY = 30
34
36
 
35
37
  def __init__(self, kubeadmin_password: str = ''):
36
38
  super().__init__()
@@ -49,20 +51,33 @@ class OC(SSH):
49
51
  self.__kubeadmin_password = self.__environment_variables_dict.get('kubeadmin_password', '')
50
52
  self.__kubeconfig_path = self.__environment_variables_dict.get('kubeconfig_path', '')
51
53
 
54
+ def _ocp_server_version(self, jsonpath: str):
55
+ """
56
+ This method returns the OCP server version with retries.
57
+ :return: OCP server version as string.
58
+ """
59
+ for attempt in range(self.RETRIES):
60
+ try:
61
+ version = self.run(f"{self.__cli} get clusterversion version -o jsonpath={{{jsonpath}}}")
62
+ return version
63
+ except Exception as err:
64
+ logger.info(f"Attempt {attempt + 1}/{self.RETRIES}: Failed to fetch OCP version. Error: {err}")
65
+ time.sleep(self.DELAY)
66
+ raise Exception("Failed to retrieve OCP server version after multiple attempts.")
67
+
52
68
  def get_ocp_server_version(self):
53
69
  """
54
- This method returns ocp server version
55
- :return:
70
+ This method returns the OCP server version with retries.
71
+ :return: OCP server version as string.
56
72
  """
57
- return self.run(f"{self.__cli} get clusterversion version -o jsonpath='{{.status.desired.version}}'")
73
+ return self._ocp_server_version(jsonpath='.status.desired.version')
58
74
 
59
75
  def get_previous_ocp_version(self):
60
76
  """
61
- This method returns the previous OpenShift server version from the history.
62
- :return: Previous OpenShift server version as a string
77
+ This method returns the previous OpenShift server version from the history with retries.
78
+ :return: Previous OCP server version as string.
63
79
  """
64
- # Run the `oc` command to get the ClusterVersion history and extract the previous version
65
- return self.run(f"{self.__cli} get clusterversion version -o jsonpath='{{.status.history[1].version}}'")
80
+ return self._ocp_server_version(jsonpath='.status.history[1].version')
66
81
 
67
82
  def upgrade_ocp(self, upgrade_ocp_version: str, upgrade_channel: str = 'stable'):
68
83
  """
@@ -734,15 +749,21 @@ class OC(SSH):
734
749
  @logger_time_stamp
735
750
  def login(self):
736
751
  """
737
- This method logs in to the cluster
738
- :return:
752
+ Logs in to the cluster with retries.
739
753
  """
740
- try:
741
- if self.__kubeadmin_password and self.__kubeadmin_password != '':
742
- self.run(f'{self.__cli} login {self.get_kube_api_server()} -u kubeadmin -p {self.__kubeadmin_password}', is_check=True)
743
- except Exception as err:
744
- raise LoginFailed
745
- return True
754
+ for attempt in range(self.RETRIES):
755
+ try:
756
+ if self.__kubeadmin_password and self.__kubeadmin_password.strip():
757
+ self.run(
758
+ f'{self.__cli} login {self.get_kube_api_server()} -u kubeadmin -p {self.__kubeadmin_password}',
759
+ is_check=True)
760
+ return True # Success
761
+ except Exception as err:
762
+ logger.info(f"Login attempt {attempt + 1} failed: {err}")
763
+ if attempt < self.RETRIES - 1:
764
+ time.sleep(self.DELAY)
765
+ else:
766
+ raise LoginFailed(msg="Login failed after multiple attempts")
746
767
 
747
768
  @typechecked
748
769
  @logger_time_stamp
@@ -7,8 +7,8 @@ class OCError(Exception):
7
7
 
8
8
  class LoginFailed(OCError):
9
9
  """This exception return login failed error"""
10
- def __init__(self):
11
- self.message = f'Login error, check credentials'
10
+ def __init__(self, msg):
11
+ self.message = msg
12
12
  super(LoginFailed, self).__init__(self.message)
13
13
 
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: benchmark-runner
3
- Version: 1.0.748
3
+ Version: 1.0.750
4
4
  Summary: Benchmark Runner Tool
5
5
  Home-page: https://github.com/redhat-performance/benchmark-runner
6
6
  Author: Red Hat
@@ -46,8 +46,8 @@ benchmark_runner/common/logger/init_logger.py,sha256=ERa-gNqrl2pZybj7v3csvmao7Mv
46
46
  benchmark_runner/common/logger/logger_exceptions.py,sha256=rivdlRm_jIsKQ53rP_-HX8emdtOmQNO4JuIkg8fnBoc,454
47
47
  benchmark_runner/common/logger/logger_time_stamp.py,sha256=2JgugN9LpXF4Ijx0wPRzz3DAGJB8eJpM5g1qPvbWbV8,1479
48
48
  benchmark_runner/common/oc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
- benchmark_runner/common/oc/oc.py,sha256=Y0POw_y6HSA0QGLMy5hnBAzbEjVR5TmNiqoszLCZ3Og,68560
50
- benchmark_runner/common/oc/oc_exceptions.py,sha256=4JDebyFqe6yIN6Y70E-oscWnme0t7Ggg_CJBBoOuFPs,6336
49
+ benchmark_runner/common/oc/oc.py,sha256=UMPUxMdQfjvIA2tOipodxDnGRbbWc56aYDXXgonyuGU,69500
50
+ benchmark_runner/common/oc/oc_exceptions.py,sha256=XfKUzeK3Ors_Y2csQEoGqrlsZlYvq6OXLkFh9s_mQRM,6311
51
51
  benchmark_runner/common/ocp_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  benchmark_runner/common/ocp_resources/create_cnv.py,sha256=AXsyR8_g_RIFHz2rkyHzzvvUDIiGdOi9rZWJPhiPzDQ,3511
53
53
  benchmark_runner/common/ocp_resources/create_custom.py,sha256=rthm96yDzI-Hke54hLWTs0O3gDtpQPR6n184ehaEevo,1029
@@ -172,8 +172,8 @@ benchmark_runner/workloads/windows_vm.py,sha256=eHK79ueAkSlNC1uamz19o7CO20wzJi-U
172
172
  benchmark_runner/workloads/workloads.py,sha256=F9fnk4h715tq7ANSCbDH0jktB8fpr_u3YG61Kdi5_os,1422
173
173
  benchmark_runner/workloads/workloads_exceptions.py,sha256=u7VII95iPRF_YhfpGH1U1RmgiIYESMOtbSF1dz7_ToE,1858
174
174
  benchmark_runner/workloads/workloads_operations.py,sha256=SdddQUbAN5biRjZr5CvmlgKxcE4xatCnoSBm9cn1K9A,25286
175
- benchmark_runner-1.0.748.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
176
- benchmark_runner-1.0.748.dist-info/METADATA,sha256=oM0ncfbh10EECRnTEWmIu1kGxNZW4ixgxtBPa8G8f4w,11498
177
- benchmark_runner-1.0.748.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
178
- benchmark_runner-1.0.748.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
179
- benchmark_runner-1.0.748.dist-info/RECORD,,
175
+ benchmark_runner-1.0.750.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
176
+ benchmark_runner-1.0.750.dist-info/METADATA,sha256=aQWMmpbytUbaMi2gUufFV2zAcCia1M2VFyy9u6sny08,11498
177
+ benchmark_runner-1.0.750.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
178
+ benchmark_runner-1.0.750.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
179
+ benchmark_runner-1.0.750.dist-info/RECORD,,