Skip to content

Commit

Permalink
Add tasks for clear_index and init_index
Browse files Browse the repository at this point in the history
  • Loading branch information
bartjkdp committed Jul 25, 2023
1 parent 3081ffa commit 501e05f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/signals/apps/search/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ def save_to_elastic(signal_id):
signal_document.save()


@app.task
def clear_index():
log.info('clear_index - start')

if not SignalDocument.ping():
raise Exception('Elastic cluster is unreachable')

SignalDocument.clear_index()

log.info('clear_index - done!')


@app.task
def init_index():
log.info('init_index - start')

if not SignalDocument.ping():
raise Exception('Elastic cluster is unreachable')

SignalDocument.init()

log.info('init_index - done!')


@app.task
def rebuild_index():
log.info('rebuild_index - start')
Expand Down

0 comments on commit 501e05f

Please sign in to comment.