From 4f6c595584c10af253fdb111edcf55f90a609fe3 Mon Sep 17 00:00:00 2001 From: Krzysztof Findeisen Date: Tue, 7 Jan 2025 17:10:44 -0800 Subject: [PATCH 1/2] Remove references to ApdbMetricTask.dbLoader. --- tests/test_metrics.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_metrics.py b/tests/test_metrics.py index 56418588..e9e87dea 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -304,7 +304,6 @@ class TestTotalUnassociatedObjects(ApdbMetricTestCase): @classmethod def makeTask(cls): config = TotalUnassociatedDiaObjectsMetricTask.ConfigClass() - config.doReadMarker = False config.apdb_config_url = "dummy/path.yaml" return TotalUnassociatedDiaObjectsMetricTask(config=config) From d1c7ff8d1ec29ffbd9a020d3609af93cb42162c9 Mon Sep 17 00:00:00 2001 From: Krzysztof Findeisen Date: Tue, 7 Jan 2025 17:12:43 -0800 Subject: [PATCH 2/2] Remove DiaPipelineTask.apdb and all references to it. The apdb nested config was deprecated and replaced with a central config file in w_2024_18. --- python/lsst/ap/association/diaPipe.py | 43 ++------------------------- tests/test_diaPipe.py | 36 ---------------------- 2 files changed, 2 insertions(+), 77 deletions(-) diff --git a/python/lsst/ap/association/diaPipe.py b/python/lsst/ap/association/diaPipe.py index 19f0603c..f9b872b8 100644 --- a/python/lsst/ap/association/diaPipe.py +++ b/python/lsst/ap/association/diaPipe.py @@ -31,8 +31,6 @@ "DiaPipelineConnections") -import warnings - import lsst.dax.apdb as daxApdb import lsst.pex.config as pexConfig import lsst.pipe.base as pipeBase @@ -234,13 +232,6 @@ class DiaPipelineConfig(pipeBase.PipelineTaskConfig, dtype=str, default="deep", ) - apdb = pexConfig.ConfigurableField( # TODO: remove on DM-43419 - target=daxApdb.ApdbSql, - doc="Database connection for storing associated DiaSources and " - "DiaObjects. Must already be initialized.", - deprecated="This field has been replaced by ``apdb_config_url``; set " - "``doConfigureApdb=False`` to use it. Will be removed after v28.", - ) apdb_config_url = pexConfig.Field( dtype=str, default=None, @@ -311,19 +302,8 @@ class DiaPipelineConfig(pipeBase.PipelineTaskConfig, "diaObjects for association.", ) idGenerator = DetectorVisitIdGeneratorConfig.make_field() - doConfigureApdb = pexConfig.Field( # TODO: remove on DM-43419 - dtype=bool, - default=True, - doc="Use the deprecated ``apdb`` sub-config to set up the APDB, " - "instead of the new config (``apdb_config_url``). This field is " - "provided for backward-compatibility ONLY and will be removed " - "without notice after v28.", - ) def setDefaults(self): - if self.doConfigureApdb: - self.apdb.dia_object_index = "baseline" - self.apdb.dia_object_columns = [] self.diaCalculation.plugins = ["ap_meanPosition", "ap_nDiaSources", "ap_meanFlux", @@ -340,22 +320,6 @@ def setDefaults(self): "ap_meanTotFlux", "ap_sigmaTotFlux"] - # TODO: remove on DM-43419 - def validate(self): - # Sidestep Config.validate to avoid validating uninitialized fields we're not using. - skip = {"apdb_config_url"} if self.doConfigureApdb else {"apdb"} - for name, field in self._fields.items(): - if name not in skip: - field.validate(self) - - # It's possible to use apdb without setting it, bypassing the deprecation warning. - if self.doConfigureApdb: - warnings.warn("Config field DiaPipelineConfig.apdb is deprecated: " - # Workaround for DM-44051 - "This field has been replaced by ``apdb_config_url``; set " - "``doConfigureApdb=False`` to use it. Will be removed after v28.", - FutureWarning) - class DiaPipelineTask(pipeBase.PipelineTask): """Task for loading, associating and storing Difference Image Analysis @@ -366,10 +330,7 @@ class DiaPipelineTask(pipeBase.PipelineTask): def __init__(self, initInputs=None, **kwargs): super().__init__(**kwargs) - if self.config.doConfigureApdb: - self.apdb = self.config.apdb.apply() - else: - self.apdb = daxApdb.Apdb.from_uri(self.config.apdb_config_url) + self.apdb = daxApdb.Apdb.from_uri(self.config.apdb_config_url) self.schema = readSchemaFromApdb(self.apdb) self.makeSubtask("associator") self.makeSubtask("diaCalculation") @@ -551,7 +512,7 @@ def run(self, # For historical reasons, apdbMarker is a Config even if it's not meant to be read. # A default Config is the cheapest way to satisfy the storage class. - marker = self.config.apdb.value if self.config.doConfigureApdb else pexConfig.Config() + marker = pexConfig.Config() return pipeBase.Struct(apdbMarker=marker, associatedDiaSources=associatedDiaSources, diaForcedSources=diaForcedSources, diff --git a/tests/test_diaPipe.py b/tests/test_diaPipe.py index b543618b..9da7a3b2 100644 --- a/tests/test_diaPipe.py +++ b/tests/test_diaPipe.py @@ -60,7 +60,6 @@ class TestDiaPipelineTask(unittest.TestCase): @classmethod def _makeDefaultConfig(cls, config_file, **kwargs): config = DiaPipelineTask.ConfigClass() - config.doConfigureApdb = False config.apdb_config_url = config_file config.update(**kwargs) return config @@ -89,41 +88,6 @@ def setUp(self): self.addCleanup(self.config_file.close) apdb_config.save(self.config_file.name) - # TODO: remove on DM-43419 - def testConfigApdbNestedOk(self): - config = DiaPipelineTask.ConfigClass() - config.doConfigureApdb = True - with self.assertWarns(FutureWarning): - config.apdb.db_url = "sqlite://" - config.freeze() - config.validate() - - # TODO: remove on DM-43419 - def testConfigApdbNestedInvalid(self): - config = DiaPipelineTask.ConfigClass() - config.doConfigureApdb = True - # Don't set db_url - config.freeze() - with self.assertRaises(pexConfig.FieldValidationError): - config.validate() - - # TODO: remove on DM-43419 - def testConfigApdbFileOk(self): - config = DiaPipelineTask.ConfigClass() - config.doConfigureApdb = False - config.apdb_config_url = "some/file/path.yaml" - config.freeze() - config.validate() - - # TODO: remove on DM-43419 - def testConfigApdbFileInvalid(self): - config = DiaPipelineTask.ConfigClass() - config.doConfigureApdb = False - # Don't set apdb_config_url - config.freeze() - with self.assertRaises(pexConfig.FieldValidationError): - config.validate() - def testRun(self): """Test running while creating and packaging alerts. """