diff options
author | Linus Nordberg <linus@nordu.net> | 2016-12-01 13:31:36 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-12-01 13:31:36 +0100 |
commit | 017417cc93c85035f170883722b4fff3cbbcc2fd (patch) | |
tree | 61c09a6115a29b070555400ae18625815f802534 /tools/merge_fetch.py | |
parent | 41960e65d1e2904987d590e384d9e60ba1824e4d (diff) |
Don't crash when restarting merge_fetch worker process.
Store storagenode object in procs as well.
Diffstat (limited to 'tools/merge_fetch.py')
-rwxr-xr-x | tools/merge_fetch.py | 12 |
1 files 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)) |