Skip to content

Commit 2f1190b

Browse files
committed
Import the IERS cache on service/initializer start.
The function checks if the cache has already been imported and skips download if that's the case.
1 parent da6b101 commit 2f1190b

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

config/astropy.cfg

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ allow_internet = False
1010
## the IERS-A file was previously downloaded and cached). This parameter also
1111
## controls whether internet resources will be queried to update the leap
1212
## second table if the installed version is out of date. Default is True.
13-
auto_download = False
1413

15-
## Maximum age (days) of predictive data before auto-downloading. See "Auto
16-
## refresh behavior" in astropy.utils.iers documentation for details. Default
17-
## is 30.
18-
auto_max_age = 1000
14+
# Defer to the cache (which is updated on pod start).
15+
auto_download = True

python/activator/activator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import prometheus_client as prometheus
4545
import redis
4646

47+
from shared.astropy import import_iers_cache
4748
from shared.config import PipelinesConfig
4849
from shared.logger import setup_usdf_logger
4950
from shared.raw import (
@@ -456,6 +457,7 @@ def create_app():
456457
)
457458

458459
# Check initialization and abort early
460+
import_iers_cache()
459461
_get_consumer()
460462
_get_storage_client()
461463
_get_read_butler()
@@ -504,6 +506,7 @@ def keda_start():
504506
registry.init_tracker()
505507

506508
# Check initialization and abort early
509+
import_iers_cache()
507510
_get_consumer()
508511
_get_storage_client()
509512
_get_read_butler()

python/initializer/write_init_outputs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import lsst.daf.butler
3737
import lsst.pipe.base
3838

39+
from shared.astropy import import_iers_cache
3940
from shared.config import PipelinesConfig
4041
from shared import connect_utils
4142
from shared.logger import setup_usdf_logger
@@ -107,6 +108,7 @@ def main(args=None):
107108
setup_usdf_logger(labels={"instrument": instrument_name},)
108109
try:
109110
repo = os.environ["CENTRAL_REPO"]
111+
import_iers_cache() # Should not be needed, but best to be consistent
110112
_log.info("Preparing init-outputs for %s in %s.", instrument_name, repo)
111113

112114
parsed = make_parser().parse_args(args)

tests/test_write_init_outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ def _make_init_outputs(butler, instrument, apdb, deploy_id, pipeline):
195195
unittest.mock.patch("initializer.write_init_outputs._make_init_outputs",
196196
side_effect=_make_init_outputs) as mock_make, \
197197
unittest.mock.patch("initializer.write_init_outputs._get_current_day_obs",
198-
return_value=""):
198+
return_value=""), \
199+
unittest.mock.patch("initializer.write_init_outputs.import_iers_cache"):
199200
main(["--deploy-id", self.deploy_id])
200201

201202
# The preload collection is not associated with a pipeline

0 commit comments

Comments
 (0)