From 46a48d17c52e6b42b0fef36c3f437dfdaf9d0186 Mon Sep 17 00:00:00 2001 From: dwest77 Date: Tue, 17 Dec 2024 14:00:38 +0000 Subject: [PATCH] Added allowance for cached spot file --- cci_os_worker/fbi_update.py | 4 +++- cci_os_worker/path_tools.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cci_os_worker/fbi_update.py b/cci_os_worker/fbi_update.py index 09dc61a..3bccede 100644 --- a/cci_os_worker/fbi_update.py +++ b/cci_os_worker/fbi_update.py @@ -72,6 +72,8 @@ def __init__(self, conf: dict, dryrun: bool = False, test: bool = False): logger.info('Loading FBI Updater') + self._spot_file = conf.get('spot_file',None) + super().__init__(conf, dryrun=dryrun, test=test) if self._test: @@ -93,7 +95,7 @@ def __init__(self, conf: dict, dryrun: bool = False, test: bool = False): ldap_hosts = self._conf['ldap_configuration']['hosts'] self.ldap_interface = LDAPIdentifier(server=ldap_hosts, auto_bind=True) - self.pt = PathTools() + self.pt = PathTools(spot_file=self._spot_file) def _single_process_file(self, path, index,**kwargs) -> None: """ diff --git a/cci_os_worker/path_tools.py b/cci_os_worker/path_tools.py index ab89087..630186e 100644 --- a/cci_os_worker/path_tools.py +++ b/cci_os_worker/path_tools.py @@ -107,12 +107,13 @@ def __init__( self, moles_mapping_url: str = "http://api.catalogue.ceda.ac.uk/api/v2/observations.json/", mapping_file: Optional[str] = None, + spot_file: str = None, ): if os.path.isfile('moles_mapping.json'): mapping_file = 'moles_mapping.json' - self.spots = SpotMapping() + self.spots = SpotMapping(spot_file=spot_file) self.moles_mapping_url = moles_mapping_url