add debug logging to backfill: bucket, key, s3_path, and work item counts
This commit is contained in:
parent
8adf2fadaf
commit
85dffd0b24
1 changed files with 7 additions and 0 deletions
|
|
@ -41,6 +41,8 @@ def process_karaoke(s3_client, bucket, s3_key, s3_path,
|
|||
log.warning("Unsandbox API keys invalid or expired — skipping: %s", e)
|
||||
return None
|
||||
|
||||
log.info("process_karaoke: bucket=%s key=%s s3_path=%s", bucket, s3_key, s3_path)
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="karaoke_") as tmpdir:
|
||||
# 1. Download original from S3 (get_object, not download_file —
|
||||
# download_file uses boto3 TransferManager which spawns threads
|
||||
|
|
@ -201,7 +203,9 @@ def backfill_karaoke_async(shop_id, session_factory, app_settings):
|
|||
|
||||
# Collect work items
|
||||
work = []
|
||||
skipped_existing = 0
|
||||
products = session.query(Product).filter(Product.shop_id == shop_id).all()
|
||||
log.info("Backfill: %d total products for shop %s", len(products), shop.name)
|
||||
for product in products:
|
||||
for file_key in ("product", "preview"):
|
||||
ext = product.extensions.get(file_key)
|
||||
|
|
@ -211,8 +215,11 @@ def backfill_karaoke_async(shop_id, session_factory, app_settings):
|
|||
if media_type not in ("video", "audio"):
|
||||
continue
|
||||
if tracks_exist(s3, bucket, product.s3_path):
|
||||
skipped_existing += 1
|
||||
continue
|
||||
work.append((product.id, product.s3_path, product.title, file_key, ext, media_type))
|
||||
log.info("Backfill: %d audio/video items, %d already have tracks, %d to process",
|
||||
len(work) + skipped_existing, skipped_existing, len(work))
|
||||
|
||||
if not work:
|
||||
log.info("No products need backfill for shop %s", shop.name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue