From 017417cc93c85035f170883722b4fff3cbbcc2fd Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Thu, 1 Dec 2016 13:31:36 +0100 Subject: Don't crash when restarting merge_fetch worker process. Store storagenode object in procs as well. --- tools/merge_fetch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/merge_fetch.py b/tools/merge_fetch.py index e0a6243..d6c8cb3 100755 --- a/tools/merge_fetch.py +++ b/tools/merge_fetch.py @@ -176,7 +176,8 @@ def merge_fetch_parallel(args, config, localconfig): procs = {} for storagenode in storagenodes: name = storagenode['name'] - procs[name] = newworker(name, [args, localconfig, storagenode]) + procs[name] = newworker(name, + [args, localconfig, storagenode]) + (storagenode,) currentsizefilecontent = "" # Entries in log, kept in both a set and a list. @@ -194,11 +195,12 @@ def merge_fetch_parallel(args, config, localconfig): ## Poll worker processes and handle messages. assert not fetch_set newentry = [] - for name, pipe, p in procs.values(): + for name, pipe, p, storagenode in procs.values(): if not p.is_alive(): logging.warning("%s is gone, restarting", name) - procs[name] = newworker(name, [args, localconfig, - storagenodes[name]]) + procs[name] = \ + newworker(name, + [args, localconfig, storagenode]) + (storagenode,) continue logging.info("polling %s", name) while pipe.poll(): @@ -241,7 +243,7 @@ def merge_fetch_parallel(args, config, localconfig): l = list(procs.values()) rand.shuffle(l) fetch_dict[e] = cycle(l) - name, pipe, _ = fetch_dict[e].next() + name, pipe, _, _ = fetch_dict[e].next() logging.info("asking %s to FETCH %s", name, hexencode(e)) pipe.send(('FETCH', e)) -- cgit v1.1