Skip to content

Commit

Permalink
Ensure DiaPipelineTask's defaults are used by make_apdb.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Nov 2, 2020
1 parent 99ca9b5 commit 903328e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/lsst/ap/pipe/make_apdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import argparse

from lsst.dax.apdb import ApdbConfig, Apdb
from lsst.ap.association import make_dia_object_schema, make_dia_source_schema
from lsst.dax.apdb import Apdb
from lsst.ap.association import DiaPipelineConfig, make_dia_object_schema, make_dia_source_schema


class ConfigOnlyParser(argparse.ArgumentParser):
Expand Down Expand Up @@ -73,7 +73,8 @@ def parse_args(self, args=None, namespace=None):
"""
if not namespace:
namespace = argparse.Namespace()
namespace.config = ApdbConfig()
# Make ApdbConfig as a subconfig of DiaPipelineConfig to ensure correct defaults get set
namespace.config = DiaPipelineConfig().apdb.value

# ConfigFileAction and ConfigValueAction require namespace.config to exist
namespace = super().parse_args(args, namespace)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_makeapdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ def testSetValueFile(self):
self.assertEqual(parsed.config.db_url, 'dummy')
self.assertEqual(parsed.config.dia_object_index, 'pix_id_iov')

def testDiaPipeDefaults(self):
"""Verify that DiaPipelineTask's custom APDB settings are included.
"""
args = '-c db_url="dummy"'
parsed = self._parseString(args)
self.assertIn("ap_association", parsed.config.extra_schema_file)

@contextlib.contextmanager
def _temporaryBuffer(self):
tempStdErr = io.StringIO()
Expand Down

0 comments on commit 903328e

Please sign in to comment.