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

added jobs/check-update-status route

parent 5f30c24b
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,10 @@ def update():
status=503,
mimetype="text/html")
phase2_task_id = worker.launch_refresh_cache_all(
current_app.config["INVENTORY_PROVIDER_CONFIG"])
phase2_task_id = worker.launch_refresh_cache_all(config)
r = common.get_current_redis()
r.set('classifier-cache:update-task-id', phase2_task_id.encode('utf-8'))
return jsonify({'task id': phase2_task_id})
......@@ -47,4 +49,19 @@ def reload_router_config(equipment_name):
@routes.route("check-task-status/<task_id>", methods=['GET', 'POST'])
@common.require_accepts_json
def check_task_status(task_id):
return jsonify(worker.check_task_status(task_id))
return jsonify(list(worker.check_task_status(task_id)))
@routes.route("check-update-status", methods=['GET', 'POST'])
@common.require_accepts_json
def check_update_status(task_id):
r = common.get_current_redis()
task_id = r.get('classifier-cache:update-task-id')
if not task_id:
return Response(
response='no pending update task found',
status=404,
mimetype="text/html")
task_id = task_id.decode('utf-8')
return jsonify(list(worker.check_task_status(task_id)))
......@@ -585,6 +585,8 @@ def launch_refresh_cache_all(config):
update_latch_status(config, pending=True)
# TODO: [DBOARD3-242] catch exceptions & reset latch status
# first batch of subtasks: refresh cached opsdb data
subtasks = [
update_neteng_managed_device_list.apply_async(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment