Skip to content

Commit 7a26660

Browse files
authored
Publisher fixups (#60)
* fixup publisher * one batch * StorageClient batch sizes cannot exceed 1000
1 parent 352ae94 commit 7a26660

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
SIMPLE_TABLE = os.environ.get("BIGQUERY_SIMPLE_TABLE")
3333
DOWNLOAD_TABLE = os.environ.get("BIGQUERY_DOWNLOAD_TABLE")
3434
MAX_BLOBS_PER_RUN = int(
35-
os.environ.get("MAX_BLOBS_PER_RUN", "5000")
36-
) # Cannot exceed 10,000
35+
os.environ.get("MAX_BLOBS_PER_RUN", "1000")
36+
) # Cannot exceed 10,000 per load, or 1,000 per batch call to delete blobs
3737

3838
prefix = {Simple.__name__: "simple_requests", Download.__name__: "file_downloads"}
3939

@@ -187,5 +187,6 @@ def load_processed_files_into_bigquery(event, context):
187187
with storage_client.batch():
188188
for blob in download_source_blobs:
189189
blob.delete()
190+
with storage_client.batch():
190191
for blob in simple_source_blobs:
191192
blob.delete()

test_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ def fake_batch(*a, **kw):
212212
pretend.call(RESULT_BUCKET),
213213
]
214214
assert bucket_stub.list_blobs.calls == [
215-
pretend.call(prefix=f"processed/{partition}/downloads-", max_results=5000),
216-
pretend.call(prefix=f"processed/{partition}/simple-", max_results=5000),
215+
pretend.call(prefix=f"processed/{partition}/downloads-", max_results=1000),
216+
pretend.call(prefix=f"processed/{partition}/simple-", max_results=1000),
217217
]
218218
assert (
219219
load_job_stub.result.calls

0 commit comments

Comments
 (0)