Skip to content
Snippets Groups Projects
Commit ce6dcfce authored by Erik Reid's avatar Erik Reid
Browse files

catch RedisError's and reset latch status

parent 36b5f906
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ import logging ...@@ -3,6 +3,8 @@ import logging
import os import os
import time import time
from redis.exceptions import RedisError
from celery import Task, states from celery import Task, states
from celery.result import AsyncResult from celery.result import AsyncResult
...@@ -548,26 +550,30 @@ def launch_refresh_cache_all(config): ...@@ -548,26 +550,30 @@ def launch_refresh_cache_all(config):
:return: :return:
""" """
_erase_next_db(config) try:
monitor.clear_joblog(get_current_redis(config)) _erase_next_db(config)
monitor.clear_joblog(get_current_redis(config))
update_latch_status(config, pending=True)
update_latch_status(config, pending=True)
# TODO: [DBOARD3-242] catch exceptions & reset latch status
# first batch of subtasks: refresh cached opsdb data
# first batch of subtasks: refresh cached opsdb data subtasks = [
subtasks = [ update_neteng_managed_device_list.apply_async(),
update_neteng_managed_device_list.apply_async(), update_interfaces_to_services.apply_async(),
update_interfaces_to_services.apply_async(), update_geant_lambdas.apply_async(),
update_geant_lambdas.apply_async(), update_circuit_hierarchy.apply_async()
update_circuit_hierarchy.apply_async() ]
] [x.get() for x in subtasks]
[x.get() for x in subtasks]
# now launch the task whose only purpose is to
# now launch the task whose only purpose is to # act as a convenient parent for all of the remaining tasks
# act as a convenient parent for all of the remaining tasks t = internal_refresh_phase_2.apply_async()
t = internal_refresh_phase_2.apply_async() return t.id
return t.id
except RedisError:
update_latch_status(config, pending=False, failure=True)
logger.exception('error launching refresh subtasks')
raise
def _wait_for_tasks(task_ids, update_callback=lambda s: None): def _wait_for_tasks(task_ids, update_callback=lambda s: None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment