Wrap background tasks in try/except
This commit is contained in:
parent
6ea3a95684
commit
e9835edc45
1 changed files with 16 additions and 3 deletions
|
@ -1,15 +1,28 @@
|
|||
"""
|
||||
Script that updates data in a background process.
|
||||
"""
|
||||
from logging import getLogger
|
||||
|
||||
from mwmbl.indexer import historical
|
||||
from mwmbl.indexer.preprocess import run_preprocessing
|
||||
from mwmbl.indexer.retrieve import retrieve_batches
|
||||
from mwmbl.indexer.update_pages import run_update
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
|
||||
def run(index_path: str):
|
||||
historical.run()
|
||||
while True:
|
||||
retrieve_batches()
|
||||
run_preprocessing(index_path)
|
||||
run_update(index_path)
|
||||
try:
|
||||
retrieve_batches()
|
||||
except Exception:
|
||||
logger.exception("Error retrieving batches")
|
||||
try:
|
||||
run_preprocessing(index_path)
|
||||
except Exception:
|
||||
logger.exception("Error preprocessing")
|
||||
try:
|
||||
run_update(index_path)
|
||||
except Exception:
|
||||
logger.exception("Error running index update")
|
||||
|
|
Loading…
Add table
Reference in a new issue