You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on the setup as mentioned below and getting the error:
"504 Deadline Exceeded"
Read approx. 10k rows from BigQuery in Cloud Function using Python
Write those 10k rows to a Firestore collection using the below code -
-- Batch size is selected as 500
-- It forms smaller batches (approx. 20) and loads the data
max_batch_size = 500
for i in range(0, len(records), max_batch_size):
batch_number += 1
batch = firestore_client.batch()
for data in records[i:i+max_batch_size]:
doc_ref = collection_ref.document()
batch.set(doc_ref, data)
try:
batch.commit()
except GoogleAPIError as error:
print(f"An error occurred: {error}")
I am consistently facing the "504 Deadline Exceeded" error.
Things that I have already tried -
Changing the batch size to 1000, it still fails. Changing to 200, it becomes very slow and sometimes fails as well.
Adding index to the Firestore collection (? Not sure about this since adding/removing index would help)
A few questions:
Is there any better way to handle this error? I am unable to find any consistent behavior.
As I know, the batch.commit() timeout is 60s, how can I change it to a bigger value, also is this recommended?
Can someone please help?
Thank you in advanced!
Sanket Kelkar
The text was updated successfully, but these errors were encountered:
parthea
transferred this issue from googleapis/google-cloud-python
Mar 4, 2024
Hi,
I am working on the setup as mentioned below and getting the error:
"504 Deadline Exceeded"
-- Batch size is selected as 500
-- It forms smaller batches (approx. 20) and loads the data
I am consistently facing the "504 Deadline Exceeded" error.
Things that I have already tried -
A few questions:
Can someone please help?
Thank you in advanced!
Sanket Kelkar
The text was updated successfully, but these errors were encountered: