Skip to content

Commit

Permalink
feat: create elasticsearch indices at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Dec 22, 2022
1 parent 5cd2a2b commit 17c0f17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions robotoff/scheduler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from sentry_sdk import capture_exception

from robotoff import settings, slack
from robotoff.elasticsearch import get_es_client
from robotoff.elasticsearch.export import ElasticsearchExporter
from robotoff.insights.annotate import (
UPDATED_ANNOTATION_RESULT,
InsightAnnotatorFactory,
Expand Down Expand Up @@ -200,6 +202,11 @@ def _update_data():
except requests.exceptions.RequestException:
logger.exception("Exception during product dataset refresh")

try:
ElasticsearchExporter(get_es_client()).load_all_indices()
except Exception as e:
logger.exception("Exception during ES indices creation", exc_info=e)


def generate_insights():
"""Generate and import category insights from the latest dataset dump, for
Expand Down

0 comments on commit 17c0f17

Please sign in to comment.