Skip to content

Commit

Permalink
Log number of latent insight inserted
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed May 2, 2020
1 parent 7f12210 commit 33c9981
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion robotoff/insights/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def import_insights(
insights = self.process_insights(data, server_domain, automatic)
insights = self.add_fields(insights, timestamp, server_domain)
inserted = 0
latent_inserted = 0

for raw_insight_batch in chunked(insights, 50):
insight_batch = []
Expand All @@ -101,8 +102,9 @@ def import_insights(
latent_batch.append(latent_insight)

inserted += batch_insert(ProductInsight, insight_batch, 50)
batch_insert(LatentProductInsight, latent_batch, 50)
latent_inserted += batch_insert(LatentProductInsight, latent_batch, 50)

logger.info("Latent insight inserted: {}".format(latent_insight))
return inserted

@abc.abstractmethod
Expand Down

0 comments on commit 33c9981

Please sign in to comment.