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

bugfixes and typos

parent f224e8f5
Branches
Tags
No related merge requests found
......@@ -446,7 +446,7 @@ def launch_refresh_cache_all(config):
"""
logger = logging.getLogger(__name__)
r = get_next_redis(InventoryTask.config)
r = get_next_redis(config)
r.flushdb()
# first batch of subtasks: refresh cached opsdb data
......@@ -466,13 +466,15 @@ def launch_refresh_cache_all(config):
]
# for hostname in _derive_router_hostnames(config):
hostnames = _derive_router_hostnames(config)
for hostname in hostnames[0:2]:
logger.debug('queueing router refresh jobs for %r' % hostname)
subtasks.append(reload_router_config.apply_async(args=[hostname]))
hostnames = list(hostnames)[:2]
logger.error("HOSTNAMES: %r" % hostnames)
# for hostname in hostnames:
# logger.debug('queueing router refresh jobs for %r' % hostname)
# subtasks.append(reload_router_config.apply_async(args=[hostname]))
pending_task_ids = [x.id for x in subtasks]
t = refresh_finalizer.apply_async(args=json.dumps(pending_task_ids))
t = refresh_finalizer.apply_async(args=[json.dumps(pending_task_ids)])
pending_task_ids.append(t.id)
return pending_task_ids
......@@ -481,7 +483,7 @@ def _wait_for_tasks(task_ids):
logger = logging.getLogger(__name__)
start_time = time.time()
while task_ids and time.time() - start_time > FINALIZER_TIMEOUT_S:
while task_ids and time.time() - start_time < FINALIZER_TIMEOUT_S:
logger.debug('waiting for tasks to complete: %r', task_ids)
time.sleep(FINALIZER_POLLING_FREQUENCY_S)
task_ids = [
......@@ -502,6 +504,7 @@ def _wait_for_tasks(task_ids):
def refresh_finalizer(self, pending_task_ids_json):
logger = logging.getLogger(__name__)
logger.debug('>>> refresh_finalizer')
logger.debug('task_ids: %r' % pending_task_ids_json)
input_schema = {
"$schema": "http://json-schema.org/draft-07/schema#",
......@@ -510,7 +513,8 @@ def refresh_finalizer(self, pending_task_ids_json):
}
task_ids = json.loads(pending_task_ids_json)
assert jsonschema.validate(task_ids, input_schema)
logger.debug('task_ids: %r' % task_ids)
jsonschema.validate(task_ids, input_schema)
_wait_for_tasks(task_ids)
_build_subnet_db()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment