From c48f183052c6abe75f07be2f889c9d70567ab77e Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Fri, 10 May 2024 15:12:38 +0100
Subject: [PATCH] fixing logger

---
 coordinator/extra/ProcessorMetResample.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/coordinator/extra/ProcessorMetResample.py b/coordinator/extra/ProcessorMetResample.py
index c4ccd37..fb7d748 100644
--- a/coordinator/extra/ProcessorMetResample.py
+++ b/coordinator/extra/ProcessorMetResample.py
@@ -24,11 +24,12 @@ from EpiModel.EpiUtils import (
 from coordinator.ProcessorUtils import add_filters_to_sublogger, calc_epi_date_range, short_name, open_and_check_config
 from coordinator.processor_base import ProcessorBase
 
+logger = logging.getLogger(__name__)
 
 class ProcessorMetResample(ProcessorBase):
 
     def process_pre_job(self, args) -> bool:
-        self.logger.debug('Performing process_pre_job()')
+        logger.debug('Performing process_pre_job()')
 
         # If it will work on a single forecast, get a dedicated download
         #return process_pre_job_server_download(args)
@@ -192,7 +193,7 @@ class ProcessorMetResample(ProcessorBase):
 
         for component in components:
 
-            self.logger.info(f"Working on {component}")
+            logger.info(f"Working on {component}")
 
             # parse the output file path
             fnp = parse_template_string(
@@ -201,11 +202,11 @@ class ProcessorMetResample(ProcessorBase):
                     f"{component} FileNamePrepared")
             config_met[component]['FileNamePrepared'] = fnp
 
-            self.logger.debug('Making the output directory')
+            logger.debug('Making the output directory')
             output_dir = os.path.dirname(config_met[component]['FileNamePrepared'])
             os.makedirs(output_dir,exist_ok=True)
 
-            self.logger.debug('Gathering data')
+            logger.debug('Gathering data')
 
             file_of_origins = self.gather_data(
                     copy.deepcopy(config_met),
@@ -216,13 +217,13 @@ class ProcessorMetResample(ProcessorBase):
 
             origins += [file_of_origins]
 
-            self.logger.debug('Performing resampling')
+            logger.debug('Performing resampling')
 
             _, path = self.resample_data(copy.deepcopy(config_met), component)
 
             paths += [path]
 
-        self.logger.info('Finished gather_and_resample()')
+        logger.info('Finished gather_and_resample()')
 
         return origins, paths
 
@@ -231,7 +232,7 @@ class ProcessorMetResample(ProcessorBase):
         """
         """
 
-        self.logger.info('started process_in_job_met_resample()')
+        logger.info('started process_in_job_met_resample()')
 
         # Initialise output variable
         proc_out = {}
@@ -279,7 +280,7 @@ class ProcessorMetResample(ProcessorBase):
             if k not in short_name.keys():
                 config_met[k]=v
 
-        self.logger.info('Calling gather_and_resample()')
+        logger.info('Calling gather_and_resample()')
 
         origins, paths_out = self.gather_and_resample(
                 config_met,
-- 
GitLab