Skip to content

Commit

Permalink
Reload config before each analysis (#5)
Browse files Browse the repository at this point in the history
* Reload config before each analysis

* Only reload config before starting an analysis, or at the start of a new scan
  • Loading branch information
dfornika authored Sep 22, 2022
1 parent 7f6d27d commit f732a82
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions auto_flu/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@ def main():
while(True):
try:
if args.config:
logging.info(json.dumps({"event_type": "load_config_start", "config_file": os.path.abspath(args.config)}))
try:
config = auto_flu.config.load_config(args.config)
# Uncomment below to see the config on stdout each time it's reloaded
# print(json.dumps(auto_fastq_symlink.config.make_config_json_serializable(config), indent=2))
logging.info(json.dumps({"event_type": "config_loaded", "config_file": os.path.abspath(args.config)}))
except json.decoder.JSONDecodeError as e:
# If we fail to load the config file, we continue on with the
# last valid config that was loaded.
logging.error(json.dumps({"event_type": "load_config_failed", "config_file": os.path.abspath(args.config)}))

scan_start_timestamp = datetime.datetime.now()
for run in core.scan(config):
if run is not None:
try:
config = auto_flu.config.load_config(args.config)
logging.info(json.dumps({"event_type": "config_loaded", "config_file": os.path.abspath(args.config)}))
except json.decoder.JSONDecodeError as e:
logging.error(json.dumps({"event_type": "load_config_failed", "config_file": os.path.abspath(args.config)}))
core.analyze_run(config, run)
if quit_when_safe:
exit(0)
Expand Down

0 comments on commit f732a82

Please sign in to comment.