From ffe20f2b2019edbda10420c81ba31b61e0fa7fa5 Mon Sep 17 00:00:00 2001 From: Krzysztof Findeisen Date: Thu, 25 Apr 2024 14:49:06 -0700 Subject: [PATCH] Add "database config" field to Workspace. This field specifies where to store the config created by ap_verify. --- python/lsst/ap/verify/workspace.py | 13 +++++++++++++ tests/test_workspace.py | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/python/lsst/ap/verify/workspace.py b/python/lsst/ap/verify/workspace.py index b22a33df..4797007f 100644 --- a/python/lsst/ap/verify/workspace.py +++ b/python/lsst/ap/verify/workspace.py @@ -114,6 +114,15 @@ def dbLocation(self): Shall be a pathname to a database suitable for the backend of `Apdb`. """ + @property + @abc.abstractmethod + def dbConfigLocation(self): + """The absolute location of the config file for the source association + database to be created or updated by the pipeline (`str`, read-only). + + The location is assumed to be a Python (`lsst.pex.config.Config`) file. + """ + @property @abc.abstractmethod def alertLocation(self): @@ -189,6 +198,10 @@ def pipelineDir(self): def dbLocation(self): return os.path.join(self._location, 'association.db') + @property + def dbConfigLocation(self): + return os.path.join(self._location, 'apdb.py') + @property def alertLocation(self): return os.path.join(self._location, 'alerts') diff --git a/tests/test_workspace.py b/tests/test_workspace.py index 12149f90..cea1312c 100644 --- a/tests/test_workspace.py +++ b/tests/test_workspace.py @@ -106,6 +106,15 @@ def testDatabase(self): # Workspace spec allows these to be URIs or paths, whatever the Butler accepts self._assertNotInDir(self._testbed.dbLocation, url2pathname(self._testbed.repo)) + def testDbConfig(self): + """Verify that a WorkspaceGen3 requests a database config in the target + directory, but not in any repository. + """ + root = self._testWorkspace + self._assertInDir(self._testbed.dbConfigLocation, root) + # Workspace spec allows these to be URIs or paths, whatever the Butler accepts + self._assertNotInDir(self._testbed.dbConfigLocation, url2pathname(self._testbed.repo)) + def testAlerts(self): """Verify that a WorkspaceGen3 requests an alert dump in the target directory, but not in any repository.