File tree 1 file changed +11
-1
lines changed
google/cloud/aiplatform/preview/vertex_ray
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 50
50
gapic_version = _BQS_GAPIC_VERSION , user_agent = f"ray-on-vertex/{ _BQS_GAPIC_VERSION } "
51
51
)
52
52
53
+ MAX_RETRY_CNT = 20
54
+
53
55
54
56
class _BigQueryDatasourceReader (Reader ):
55
57
def __init__ (
@@ -192,7 +194,7 @@ def _write_single_block(
192
194
pq .write_table (block , fp , compression = "SNAPPY" )
193
195
194
196
retry_cnt = 0
195
- while retry_cnt < 10 :
197
+ while retry_cnt < MAX_RETRY_CNT :
196
198
with open (fp , "rb" ) as source_file :
197
199
job = client .load_table_from_file (
198
200
source_file , dataset , job_config = job_config
@@ -207,6 +209,14 @@ def _write_single_block(
207
209
)
208
210
logging .debug (e )
209
211
time .sleep (11 )
212
+
213
+ # Raise exception if retry_cnt hits MAX_RETRY_CNT
214
+ if retry_cnt >= MAX_RETRY_CNT :
215
+ raise RuntimeError (
216
+ f"[Ray on Vertex AI]: Write failed due to { MAX_RETRY_CNT } "
217
+ + " repeated API rate limit exceeded responses"
218
+ )
219
+
210
220
print ("[Ray on Vertex AI]: Finished writing" , metadata .num_rows , "rows" )
211
221
212
222
project_id = project_id or initializer .global_config .project
You can’t perform that action at this time.
0 commit comments