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

@@ -1,6 +1,8 @@
1
1
 
2
2
  import os
3
+ import time
3
4
 
5
+ from googleapiclient.errors import HttpError
4
6
  from googleapiclient.discovery import build
5
7
  from google.oauth2.credentials import Credentials
6
8
  from googleapiclient.http import MediaFileUpload
@@ -137,34 +139,40 @@ class GoogleDriveOperations:
137
139
  logger.error(f"Error creating folder '{folder_name}': {e}")
138
140
  return None
139
141
 
140
- def _find_folder_id(self, parent_folder_id, folder_name):
142
+ def _find_folder_id(self, parent_folder_id, folder_name, max_retries=3, delay=5):
141
143
  """
142
- Helper method to find the folder ID by name within a specified parent folder.
144
+ Finds a folder ID by name within a specified parent folder, with retry handling.
145
+
143
146
  :param parent_folder_id: The ID of the parent folder to search within.
144
147
  :param folder_name: The name of the folder to find.
148
+ :param max_retries: The maximum number of retry attempts.
149
+ :param delay: The delay (in seconds) between retries.
145
150
  :return: The ID of the folder if found, otherwise None.
146
151
  """
147
- page_token = None
148
- while True:
149
- results = self.service.files().list(
150
- q=f"'{parent_folder_id}' in parents and trashed = false and mimeType = 'application/vnd.google-apps.folder'",
151
- includeItemsFromAllDrives=True,
152
- supportsAllDrives=True,
153
- pageSize=100,
154
- fields="nextPageToken, files(id, name)",
155
- pageToken=page_token
156
- ).execute()
157
-
158
- items = results.get('files', [])
159
- for item in items:
160
- if item['name'] == folder_name:
161
- return item['id']
162
-
163
- page_token = results.get('nextPageToken', None)
164
- if page_token is None:
165
- break
166
-
167
- return None
152
+ for attempt in range(max_retries):
153
+ try:
154
+ response = self.service.files().list(
155
+ q=f"'{parent_folder_id}' in parents and name='{folder_name}' and mimeType='application/vnd.google-apps.folder' and trashed=false",
156
+ supportsAllDrives=True,
157
+ includeItemsFromAllDrives=True,
158
+ pageSize=100,
159
+ fields="files(id, name)"
160
+ ).execute()
161
+ folders = response.get('files', [])
162
+ if folders:
163
+ return folders[0]['id']
164
+ except HttpError as e:
165
+ if e.resp.status in [403, 404]: # Permanent errors (e.g., permission denied)
166
+ logger.error(f"Permission error or folder not found: {e}")
167
+ break # No point in retrying
168
+ if attempt < max_retries - 1:
169
+ logger.warning(f"Attempt {attempt + 1} failed with error {e}. Retrying in {delay} seconds...")
170
+ time.sleep(delay)
171
+ else:
172
+ logger.error(f"Failed after {max_retries} attempts: {e}")
173
+ raise
174
+
175
+ return None # Explicit return if folder is not found
168
176
 
169
177
  def get_folder_id_by_path(self, folder_path, parent_folder_id):
170
178
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: benchmark-runner
3
- Version: 1.0.739
3
+ Version: 1.0.740
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=PuL7pWKJRTTIwnRPM6XRBNyHe4Hg6g3ee9cYZnKrdJc,15513
40
+ benchmark_runner/common/google_drive/google_drive_operations.py,sha256=V-N9Wgz25lp-7loH9Nxv97dqMYc0NY82x2E8hOpcwcw,16205
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
@@ -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=zhMAL-Zc2JtdI-LG4kxGwbGwHaLY2DfklpzM4bBG-eo,25261
175
- benchmark_runner-1.0.739.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
176
- benchmark_runner-1.0.739.dist-info/METADATA,sha256=PS3AR0_YwzwzhX4uiJV014Xn8eaggLprhFyHgDNSNU0,11498
177
- benchmark_runner-1.0.739.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
178
- benchmark_runner-1.0.739.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
179
- benchmark_runner-1.0.739.dist-info/RECORD,,
175
+ benchmark_runner-1.0.740.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
176
+ benchmark_runner-1.0.740.dist-info/METADATA,sha256=y_Yy8xdbItGuAITl1xQJe4blHuymN2ugMbGRou2teuI,11498
177
+ benchmark_runner-1.0.740.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
178
+ benchmark_runner-1.0.740.dist-info/top_level.txt,sha256=MP7UbTCzu59D53uKCZl5VsQeM_vheyMc7FmryczJQbk,17
179
+ benchmark_runner-1.0.740.dist-info/RECORD,,