b5896427d4
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
22 lines
687 B
Python
22 lines
687 B
Python
"""Queue every migrated image_record with no embedding for ML re-processing."""
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy import select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from ...models import ImageRecord
|
|
|
|
|
|
async def queue_all_unprocessed_async(db: AsyncSession) -> int:
|
|
"""Find every ImageRecord with siglip_embedding IS NULL, fire
|
|
tag_and_embed.delay(id) for each. Returns count queued.
|
|
"""
|
|
from ...tasks.ml import tag_and_embed
|
|
|
|
rows = (await db.execute(
|
|
select(ImageRecord.id).where(ImageRecord.siglip_embedding.is_(None))
|
|
)).scalars().all()
|
|
for image_id in rows:
|
|
tag_and_embed.delay(image_id)
|
|
return len(rows)
|