Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tokenizer retry #857

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/levanter/store/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,10 +1237,24 @@ async def _copy_one_array(dest_array: JaggedArrayStore, source_array: JaggedArra
source_offsets = source_array.offsets[1 : source_num_rows + 1][ts.d[:].translate_to[0]]
source_offsets = _virtual_offset(source_offsets, data_offset)

async with ts.Transaction() as txn:
dest_offsets = dest_array.offsets
out_end = row_offset + 1 + source_num_rows
offset_future = dest_offsets.with_transaction(txn)[row_offset + 1 : out_end].write(source_offsets)
delay = 4
while True:
try:
async with ts.Transaction() as txn:
dest_offsets = dest_array.offsets
out_end = row_offset + 1 + source_num_rows
offset_future = dest_offsets.with_transaction(txn)[row_offset + 1 : out_end].write(
source_offsets
)

break
except ValueError as e:
if "Please reduce your request rate." in str(e):
logger.info("Rate limit exceeded. Retrying.")
await asyncio.sleep(delay)
delay *= 2
if delay > 120:
raise

futures.append(offset_future)

Expand Down
Loading