From 4a39695435fe5bca2cd10434410ef80dd1e0a7d0 Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Fri, 27 Jan 2023 13:57:01 +0000
Subject: [PATCH] moving the check for the "live" flag into the runProcess
 function, so will be picked up when not running directly from the command
 line

---
 coordinator/Processor.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/coordinator/Processor.py b/coordinator/Processor.py
index 2a9ae29..fec935e 100755
--- a/coordinator/Processor.py
+++ b/coordinator/Processor.py
@@ -298,10 +298,6 @@ def parse_and_check_args(todayString) -> dict:
 
     logger.info(f"Command-line options are:\n{args}")
 
-    if not args.live:
-        # remove the log handler that would send emails
-        logger.handlers = [h for h in logger.handlers if not isinstance(h, BufferingSMTPHandler.BufferingSMTPHandler)]
-
     if not isinstance(args.config_paths,list):
         logger.error('Expecting a list of config paths')
         raise RuntimeError
@@ -391,6 +387,10 @@ def run_Process(args: dict):
     # check initial state of each config file, and gather terms that must apply
     # across all provided configs
 
+    if not args["live"]:
+        # remove the log handler that would send emails
+        logger.handlers = [h for h in logger.handlers if not isinstance(h, BufferingSMTPHandler.BufferingSMTPHandler)]
+
     config_paths: List[str] = args['config_paths']
     component: str = args['component']
     start_date: str = args['start_date']
-- 
GitLab