tamar-file-hub-client 0.0.6__py3-none-any.whl → 0.0.7__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.
file_hub_client/client.py CHANGED
@@ -246,6 +246,7 @@ class TamarFileHubClient:
246
246
  request_context: Optional[RequestContext] = None,
247
247
  enable_logging: bool = True,
248
248
  log_level: str = "INFO",
249
+ options: Optional[list] = None,
249
250
  ):
250
251
  """
251
252
  初始化客户端
@@ -59,8 +59,12 @@ def retry_with_backoff(
59
59
  is_retryable, _ = ErrorClassifier.is_retryable(e)
60
60
 
61
61
  if not is_retryable:
62
+ # 尝试从 kwargs 中获取 request_id
63
+ request_id = kwargs.get('request_id', 'unknown')
64
+
62
65
  logger.debug(
63
66
  f"🚫 不可重试错误 | 操作: {func.__name__} | "
67
+ f"request_id: {request_id} | "
64
68
  f"错误: {type(e).__name__}: {str(e)} | "
65
69
  f"直接抛出异常"
66
70
  )
@@ -76,8 +80,12 @@ def retry_with_backoff(
76
80
  # HTTP 错误
77
81
  error_details = f"HTTP {e.response.status_code}: {str(e)}"
78
82
 
83
+ # 尝试从 kwargs 中获取 request_id
84
+ request_id = kwargs.get('request_id', 'unknown')
85
+
79
86
  logger.warning(
80
87
  f"🔄 触发重试 | 操作: {func.__name__} | "
88
+ f"request_id: {request_id} | "
81
89
  f"尝试: {attempt + 1}/{max_retries + 1} | "
82
90
  f"错误类型: {type(e).__name__} | "
83
91
  f"错误详情: {error_details} | "
@@ -86,8 +94,12 @@ def retry_with_backoff(
86
94
  await asyncio.sleep(delay)
87
95
  delay = min(delay * backoff_factor, max_delay)
88
96
  else:
97
+ # 尝试从 kwargs 中获取 request_id
98
+ request_id = kwargs.get('request_id', 'unknown')
99
+
89
100
  logger.error(
90
101
  f"❌ 重试失败 | 操作: {func.__name__} | "
102
+ f"request_id: {request_id} | "
91
103
  f"已达最大重试次数: {max_retries} | "
92
104
  f"最终错误: {type(e).__name__}: {str(e)}"
93
105
  )
@@ -111,8 +123,12 @@ def retry_with_backoff(
111
123
  is_retryable, _ = ErrorClassifier.is_retryable(e)
112
124
 
113
125
  if not is_retryable:
126
+ # 尝试从 kwargs 中获取 request_id
127
+ request_id = kwargs.get('request_id', 'unknown')
128
+
114
129
  logger.debug(
115
130
  f"🚫 不可重试错误 | 操作: {func.__name__} | "
131
+ f"request_id: {request_id} | "
116
132
  f"错误: {type(e).__name__}: {str(e)} | "
117
133
  f"直接抛出异常"
118
134
  )
@@ -128,8 +144,12 @@ def retry_with_backoff(
128
144
  # HTTP 错误
129
145
  error_details = f"HTTP {e.response.status_code}: {str(e)}"
130
146
 
147
+ # 尝试从 kwargs 中获取 request_id
148
+ request_id = kwargs.get('request_id', 'unknown')
149
+
131
150
  logger.warning(
132
151
  f"🔄 触发重试 | 操作: {func.__name__} | "
152
+ f"request_id: {request_id} | "
133
153
  f"尝试: {attempt + 1}/{max_retries + 1} | "
134
154
  f"错误类型: {type(e).__name__} | "
135
155
  f"错误详情: {error_details} | "
@@ -138,8 +158,12 @@ def retry_with_backoff(
138
158
  time.sleep(delay)
139
159
  delay = min(delay * backoff_factor, max_delay)
140
160
  else:
161
+ # 尝试从 kwargs 中获取 request_id
162
+ request_id = kwargs.get('request_id', 'unknown')
163
+
141
164
  logger.error(
142
165
  f"❌ 重试失败 | 操作: {func.__name__} | "
166
+ f"request_id: {request_id} | "
143
167
  f"已达最大重试次数: {max_retries} | "
144
168
  f"最终错误: {type(e).__name__}: {str(e)}"
145
169
  )
@@ -193,8 +217,12 @@ def retry_on_lock_conflict(
193
217
  if 'error_message' in result:
194
218
  conflict_details += f" - {result['error_message']}"
195
219
 
220
+ # 尝试从 kwargs 中获取 request_id
221
+ request_id = kwargs.get('request_id', 'unknown')
222
+
196
223
  logger.warning(
197
224
  f"🔒 锁冲突重试 | 操作: {func.__name__} | "
225
+ f"request_id: {request_id} | "
198
226
  f"尝试: {attempt + 1}/{max_retries + 1} | "
199
227
  f"冲突详情: {conflict_details} | "
200
228
  f"延迟: {delay:.1f}秒"
@@ -203,8 +231,12 @@ def retry_on_lock_conflict(
203
231
  delay = min(delay * backoff_factor, max_delay)
204
232
  continue
205
233
  else:
234
+ # 尝试从 kwargs 中获取 request_id
235
+ request_id = kwargs.get('request_id', 'unknown')
236
+
206
237
  logger.error(
207
238
  f"❌ 锁冲突重试失败 | 操作: {func.__name__} | "
239
+ f"request_id: {request_id} | "
208
240
  f"已达最大重试次数: {max_retries} | "
209
241
  f"返回最后的冲突结果"
210
242
  )
@@ -238,8 +270,12 @@ def retry_on_lock_conflict(
238
270
  if 'error_message' in result:
239
271
  conflict_details += f" - {result['error_message']}"
240
272
 
273
+ # 尝试从 kwargs 中获取 request_id
274
+ request_id = kwargs.get('request_id', 'unknown')
275
+
241
276
  logger.warning(
242
277
  f"🔒 锁冲突重试 | 操作: {func.__name__} | "
278
+ f"request_id: {request_id} | "
243
279
  f"尝试: {attempt + 1}/{max_retries + 1} | "
244
280
  f"冲突详情: {conflict_details} | "
245
281
  f"延迟: {delay:.1f}秒"
@@ -248,8 +284,12 @@ def retry_on_lock_conflict(
248
284
  delay = min(delay * backoff_factor, max_delay)
249
285
  continue
250
286
  else:
287
+ # 尝试从 kwargs 中获取 request_id
288
+ request_id = kwargs.get('request_id', 'unknown')
289
+
251
290
  logger.error(
252
291
  f"❌ 锁冲突重试失败 | 操作: {func.__name__} | "
292
+ f"request_id: {request_id} | "
253
293
  f"已达最大重试次数: {max_retries} | "
254
294
  f"返回最后的冲突结果"
255
295
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tamar-file-hub-client
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A Python SDK for gRPC-based file management system
5
5
  Home-page: https://github.com/Tamar-Edge-AI/file-hub-client
6
6
  Author: Oscar Ou
@@ -1,5 +1,5 @@
1
1
  file_hub_client/__init__.py,sha256=5pOOgw8YLzsQ49o81j5xCFtiH7VHFObNlbAYZwsU7ts,2918
2
- file_hub_client/client.py,sha256=OJ7tveaGkSc4gP4b58Qecu3Yw4NBhTCjZZEj59Xcx30,17294
2
+ file_hub_client/client.py,sha256=kOis7hw0WAi-YAmEM_1PEzp0hsOD9JSxLbJi2cvTd_o,17338
3
3
  file_hub_client/py.typed,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
4
4
  file_hub_client/enums/__init__.py,sha256=e3Io6-IC9Nezbdc8H4TzuWqiDw0T1fsdbSi-fsgSQM4,203
5
5
  file_hub_client/enums/export_format.py,sha256=C9P0q8v5eTszUBqKBmERxoA9UrTgLuX3a_bZeUxkdlQ,296
@@ -48,10 +48,10 @@ file_hub_client/utils/download_helper.py,sha256=Mc8TQSWjHxIglJMkKlGy9r3LZe8e_Mwe
48
48
  file_hub_client/utils/file_utils.py,sha256=Ly8R5KJS_3lbgJxNZkc4sSBKuGgn-fYeh17GEY4pyy8,4359
49
49
  file_hub_client/utils/idempotency.py,sha256=zuXDlpAc9VTkTsarlnkO0VuJ77yON6j1TX0GvL9Xd9k,6029
50
50
  file_hub_client/utils/logging.py,sha256=IxcvWkA0G9s9BMiXIeFAdJX5G-Lc5-JFlS2yxOX1Swo,11741
51
- file_hub_client/utils/retry.py,sha256=MyEAYHEGljoHvVs4Kh1hX_Y3iDGcppVCSUvVkNGbC28,15609
51
+ file_hub_client/utils/retry.py,sha256=A2MBdJCEY-Ks0guq8dd5wXX22sD27N30Qy3nQIW1B_s,18019
52
52
  file_hub_client/utils/smart_retry.py,sha256=RjBhyG6SNDfMXxNxKU_qayWDD6Ihp7ow6_BPjhgflM0,16465
53
53
  file_hub_client/utils/upload_helper.py,sha256=gEtn9OXVJiGUpVev_fqrDnRQ6AFiiP9goLzFrVpqXmU,22569
54
- tamar_file_hub_client-0.0.6.dist-info/METADATA,sha256=JVRL8Uyrc-y1XnLZeaBFJxxQ-MzUPLaEKVqLRXhScWk,64873
55
- tamar_file_hub_client-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
- tamar_file_hub_client-0.0.6.dist-info/top_level.txt,sha256=9wcR7hyAJQdJg_kuH6WR3nmpJ8O-j8aJNK8f_kcFy6U,16
57
- tamar_file_hub_client-0.0.6.dist-info/RECORD,,
54
+ tamar_file_hub_client-0.0.7.dist-info/METADATA,sha256=L5oYQPn0MWDeZjntI6wK449X8iZguUJ3UI-XHYA-wFI,64873
55
+ tamar_file_hub_client-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
+ tamar_file_hub_client-0.0.7.dist-info/top_level.txt,sha256=9wcR7hyAJQdJg_kuH6WR3nmpJ8O-j8aJNK8f_kcFy6U,16
57
+ tamar_file_hub_client-0.0.7.dist-info/RECORD,,