MCPcopy Create free account
hub / github.com/cosdata/cosdata / upsert_with_retry

Function upsert_with_retry

tests/test_multiple_datasets.py:187–203  ·  view source on GitHub ↗
(start_idx, retries=20)

Source from the content-addressed store, hash-verified

185 )
186
187 def upsert_with_retry(start_idx, retries=20):
188 for attempt in range(retries):
189 try:
190 upsert_in_transaction(
191 constants["COLLECTION_NAME"],
192 txn_id,
193 vectors[start_idx : start_idx + batch_size],
194 )
195 return
196 except Exception as e:
197 print(
198 f"Upsert attempt {attempt + 1} failed for batch starting at index {start_idx}: {e}"
199 )
200 time.sleep(random.uniform(1, 3))
201 print(
202 f"Failed to upsert batch starting at index {start_idx} after {retries} attempts"
203 )
204
205 transaction = create_transaction(constants["COLLECTION_NAME"])
206 txn_id = transaction["transaction_id"]

Callers

nothing calls this directly

Calls 1

upsert_in_transactionFunction · 0.90

Tested by

no test coverage detected