benchmark-runner 1.0.702__py3-none-any.whl → 1.0.704__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.
@@ -1,6 +1,5 @@
1
1
 
2
2
  import os
3
- import json
4
3
 
5
4
  from googleapiclient.discovery import build
6
5
  from google.oauth2.credentials import Credentials
@@ -20,40 +19,32 @@ class GoogleDriveOperations:
20
19
  1. credentials.json - Obtain from the "Google Cloud Console" under "APIs & Services" > "Credentials" > "Create Credentials" and select "OAuth 2.0 Client ID".
21
20
  2. token.json - This is generated automatically. If a browser is not available, copy the token from a machine with a browser.
22
21
  """
23
- def __init__(self, google_drive_path: str, google_drive_credentials: str, google_drive_token: str, google_drive_shared_drive_id: str):
22
+ def __init__(self, google_drive_path: str, google_drive_token_file: str, google_drive_credentials_file: str, google_drive_shared_drive_id: str):
24
23
  """
25
24
  Initializes GoogleDriveOperations with authentication.
26
25
  """
27
- self._google_drive_path = google_drive_path
28
- self._google_drive_credentials = google_drive_credentials
29
- self._google_drive_token = google_drive_token
26
+ self._google_drive_token = google_drive_token_file # Read token from file
27
+ self._google_drive_credentials = google_drive_credentials_file # Read credentials from file
30
28
  self._google_drive_shared_drive_id = google_drive_shared_drive_id
29
+ self._google_drive_path = google_drive_path
31
30
  self.creds = self.authenticate()
32
31
  self.service = build('drive', 'v3', credentials=self.creds)
33
32
 
34
33
  def authenticate(self):
35
- """
36
- Authenticates and returns credentials using token or interactive login.
37
- :return: Credentials object
38
- """
39
34
  creds = None
40
-
41
- # Load credentials from the token string if it exists
42
- if self._google_drive_token:
43
- creds = Credentials.from_authorized_user_info(json.loads(self._google_drive_token), SCOPES)
44
-
45
- # Check if the credentials are invalid or expired
35
+ # Load credentials from token.json if it exists
36
+ if os.path.exists(self._google_drive_token):
37
+ creds = Credentials.from_authorized_user_file(self._google_drive_token, SCOPES)
38
+ # If credentials are not valid or do not exist, authenticate
46
39
  if not creds or not creds.valid:
47
40
  if creds and creds.expired and creds.refresh_token:
48
41
  creds.refresh(Request())
49
42
  else:
50
- # Load client secrets from the credentials string and run the local server for auth
51
- flow = InstalledAppFlow.from_client_config(json.loads(self._google_drive_credentials), SCOPES)
43
+ flow = InstalledAppFlow.from_client_secrets_file(self._google_drive_credentials, SCOPES)
52
44
  creds = flow.run_local_server(port=0)
53
-
54
- # Save the new token to the variable as a string
55
- self._google_drive_token = creds.to_json()
56
-
45
+ # Save the credentials for the next run
46
+ with open(self._google_drive_credentials, 'w') as token_file:
47
+ token_file.write(creds.to_json())
57
48
  return creds
58
49
 
59
50
  def list_folders_and_files_in_shared_drive(self, shared_drive_id):
@@ -208,10 +208,10 @@ class EnvironmentVariables:
208
208
  self._environment_variables_dict['bucket'] = EnvironmentVariables.get_env('IBM_BUCKET', '')
209
209
  self._environment_variables_dict['key'] = EnvironmentVariables.get_env('IBM_KEY', '')
210
210
 
211
- # Google drive
211
+ # Google drive, use file for credentials (jenkins limitation)
212
212
  self._environment_variables_dict['google_drive_path'] = EnvironmentVariables.get_env('GOOGLE_DRIVE_PATH', '')
213
- self._environment_variables_dict['google_drive_credentials'] = EnvironmentVariables.get_env('GOOGLE_DRIVE_CREDENTIALS', '')
214
- self._environment_variables_dict['google_drive_token'] = EnvironmentVariables.get_env('GOOGLE_DRIVE_TOKEN', '')
213
+ self._environment_variables_dict['google_drive_credentials_file'] = EnvironmentVariables.get_env('GOOGLE_DRIVE_CREDENTIALS_FILE', '')
214
+ self._environment_variables_dict['google_drive_token_file'] = EnvironmentVariables.get_env('GOOGLE_DRIVE_TOKEN_FILE', '')
215
215
  self._environment_variables_dict['google_drive_shared_drive_id'] = EnvironmentVariables.get_env('GOOGLE_DRIVE_SHARED_DRIVE_ID', '')
216
216
 
217
217
  # Grafana
@@ -110,13 +110,13 @@ class WorkloadsOperations:
110
110
  self._windows_os = os.path.splitext(file_name)[0]
111
111
  # google drive
112
112
  self._google_drive_path = self._environment_variables_dict.get('google_drive_path', '')
113
- self._google_drive_credentials = self._environment_variables_dict.get('google_drive_credentials', '')
114
- self._google_drive_token = self._environment_variables_dict.get('google_drive_token', '')
113
+ self._google_drive_credentials_file = self._environment_variables_dict.get('google_drive_credentials_file', '')
114
+ self._google_drive_token_file = self._environment_variables_dict.get('google_drive_token_file', '')
115
115
  self._google_drive_shared_drive_id = self._environment_variables_dict.get('google_drive_shared_drive_id', '')
116
116
  if self._google_drive_path:
117
117
  self._google_drive_operation = GoogleDriveOperations(google_drive_path=self._google_drive_path,
118
- google_drive_credentials=self._google_drive_credentials,
119
- google_drive_token=self._google_drive_token,
118
+ google_drive_credentials_file=self._google_drive_credentials_file,
119
+ google_drive_token_file=self._google_drive_token_file,
120
120
  google_drive_shared_drive_id=self._google_drive_shared_drive_id)
121
121
  self._upgrade_ocp_version = self._environment_variables_dict.get('upgrade_ocp_version', '')
122
122
  self._run_strategy = self._environment_variables_dict.get('run_strategy', '')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: benchmark-runner
3
- Version: 1.0.702
3
+ Version: 1.0.704
4
4
  Summary: Benchmark Runner Tool
5
5
  Home-page: https://github.com/redhat-performance/benchmark-runner
6
6
  Author: Red Hat
@@ -37,7 +37,7 @@ benchmark_runner/common/elasticsearch/elasticsearch_operations.py,sha256=fXckd9u
37
37
  benchmark_runner/common/github/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  benchmark_runner/common/github/github_operations.py,sha256=wp4zH0_4Qzb_c-GtQlP3VnN374H0aa_icGPk0pwkAZc,1111
39
39
  benchmark_runner/common/google_drive/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- benchmark_runner/common/google_drive/google_drive_operations.py,sha256=FLQT5E3xQkJUhtVEBdFUaYIMNbjkflYZTTQYCCVLc94,15632
40
+ benchmark_runner/common/google_drive/google_drive_operations.py,sha256=PuL7pWKJRTTIwnRPM6XRBNyHe4Hg6g3ee9cYZnKrdJc,15513
41
41
  benchmark_runner/common/grafana/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  benchmark_runner/common/grafana/grafana_operations.py,sha256=Emt-p44OSe_XgVp6c94EVcDEaniyYtUDQMWCGIP0GR8,4877
43
43
  benchmark_runner/common/grafana/update_grafana_latest_value_mappings.py,sha256=aBKXx1spB8O2kjVsOl5heLl5lKcU07Hx8oHJLasJpSQ,5523
@@ -158,7 +158,7 @@ benchmark_runner/krkn_hub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
158
158
  benchmark_runner/krkn_hub/krknhub_exceptions.py,sha256=Hk7Co6zZ0u2RSmBmS4ZAi21ffZaQ2ITTfl6tGLtiAdY,180
159
159
  benchmark_runner/krkn_hub/krknhub_workloads.py,sha256=qNRZA-FBQZiT6h013WbP6zBRINh3c6YMnnlksN9fssA,2851
160
160
  benchmark_runner/main/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
161
- benchmark_runner/main/environment_variables.py,sha256=T8A3n-UInN9wiKH5ovh4TCgXaMQ9uw_XThCG71v2JP0,27907
161
+ benchmark_runner/main/environment_variables.py,sha256=-4ZJCC6lHmv777xXp_0W4X7KAbZZ183N9qwoFyBVhCQ,27974
162
162
  benchmark_runner/main/environment_variables_exceptions.py,sha256=UR0Ith0P0oshsDZdJRlRq8ZUTt0h8jFvUtrnP4m4AIY,437
163
163
  benchmark_runner/main/main.py,sha256=SB-rD4U_978gP8ojGUtIsYzhSsmzeEDsUfOiJQJdz9c,14097
164
164
  benchmark_runner/main/temporary_environment_variables.py,sha256=ODSHkfhgvdr_b2e3XyvykW21MVjSdyqimREyMc2klRE,957
@@ -169,9 +169,9 @@ benchmark_runner/workloads/vdbench_vm.py,sha256=Yhoz-GbvZwA8q6qGIeSUsYhEIERj8SmJ
169
169
  benchmark_runner/workloads/windows_vm.py,sha256=eHK79ueAkSlNC1uamz19o7CO20wzJi-UIqRuTByTVxg,2373
170
170
  benchmark_runner/workloads/workloads.py,sha256=F9fnk4h715tq7ANSCbDH0jktB8fpr_u3YG61Kdi5_os,1422
171
171
  benchmark_runner/workloads/workloads_exceptions.py,sha256=u7VII95iPRF_YhfpGH1U1RmgiIYESMOtbSF1dz7_ToE,1858
172
- benchmark_runner/workloads/workloads_operations.py,sha256=tAgvdMRMu5Ybck81UBCBE6H76PN0L2GptjNRnYoFv2M,25221
173
- benchmark_runner-1.0.702.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
174
- benchmark_runner-1.0.702.dist-info/METADATA,sha256=lTYMLBqE9xGwf6N9_zvfiYTd3ICm4Vw9NoQzQnIa3nA,11309
175
- benchmark_runner-1.0.702.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
176
- benchmark_runner-1.0.702.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
177
- benchmark_runner-1.0.702.dist-info/RECORD,,
172
+ benchmark_runner/workloads/workloads_operations.py,sha256=zhMAL-Zc2JtdI-LG4kxGwbGwHaLY2DfklpzM4bBG-eo,25261
173
+ benchmark_runner-1.0.704.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
174
+ benchmark_runner-1.0.704.dist-info/METADATA,sha256=Fmd9LZkRbLjk6lLYvYdil9j8xJur42ccEPL-MAuSxrM,11309
175
+ benchmark_runner-1.0.704.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
176
+ benchmark_runner-1.0.704.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
177
+ benchmark_runner-1.0.704.dist-info/RECORD,,