From a633e91af0da7ffebb7b03338a7b0b2f6fd42f01 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Wed, 17 Jul 2019 21:51:22 +1200 Subject: [PATCH] add singular fork detection for multiple runs. Fixes #1637 --- core/__init__.py | 3 +++ core/forks.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/core/__init__.py b/core/__init__.py index a7a4ce24..61acdd49 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -198,6 +198,7 @@ META_CONTAINER = [] SECTIONS = [] CATEGORIES = [] +FORK_SET = [] MOUNTED = None GETSUBS = False @@ -859,6 +860,7 @@ def configure_passwords_file(): def configure_sections(section): global SECTIONS global CATEGORIES + global FORK_SET # check for script-defied section and if None set to allow sections SECTIONS = CFG[ tuple(x for x in CFG if CFG[x].sections and CFG[x].isenabled()) @@ -867,6 +869,7 @@ def configure_sections(section): for section, subsections in SECTIONS.items(): CATEGORIES.extend([subsection for subsection in subsections if CFG[section][subsection].isenabled()]) CATEGORIES = list(set(CATEGORIES)) + FORK_SET = [] def configure_utility_locations(): diff --git a/core/forks.py b/core/forks.py index 97be31da..f788edf1 100644 --- a/core/forks.py +++ b/core/forks.py @@ -45,6 +45,10 @@ def api_check(r, params, rem_params): def auto_fork(section, input_category): # auto-detect correct section # config settings + if core.FORK_SET: # keep using determined fork for multiple (manual) post-processing + logger.info('{section}:{category} fork set to {fork}'.format + (section=section, category=input_category, fork=core.FORK_SET[0])) + return core.FORK_SET[0], core.FORK_SET[1] cfg = dict(core.CFG[section][input_category]) @@ -168,4 +172,5 @@ def auto_fork(section, input_category): logger.info('{section}:{category} fork set to {fork}'.format (section=section, category=input_category, fork=fork[0])) + core.FORK_SET = fork return fork[0], fork[1]