Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-15588: Remove home-brewed SQLite PPDB #53

Merged
merged 8 commits into from Nov 30, 2018
Merged

Conversation

morriscb
Copy link
Contributor

No description provided.

Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (though, again, please squash the "fix typos and build problems" commits).

@@ -36,10 +36,10 @@
from .dataset import Dataset
from .ingestion import ingestDataset
from .metrics import MetricsParser, checkSquashReady, AutoJob
from .pipeline_driver import ApPipeParser, runApPipe
from .pipeline_driver import ApPipeParser, runApPipe, _getConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid forcing ap_verify.py to know about implementation details in pipeline_driver. My intent was that the measurements code could just load the config from the Butler, but I'm willing to do that myself on DM-15806.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, should I leave this as in for now then and let DM-15806 take care of it or is there is there something I can do in the mean time?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to you. I think the hardest part of that ticket would be adding a line(s) in pipeline_driver that saves the config to the Butler as if we'd called parseAndRun (much like what I do in #49).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is worth just making another ticket to do the work. It feels like it will take long enough to warrant it.

@@ -159,22 +159,19 @@ def _convertDataIdString(dataId):
return dataIdDict


def measureFromL1DbSqlite(dbName):
def measureFromPpdb(configurable):
"""Make measurements on an sqlite database containing the results of
source association.

dbName : `str`
Name of the sqlite database created from a previous run of
`lsst.ap.association.AssociationDBSqliteTask` to load.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out-of-date documentation. (Also, at present configurable is not a ConfigurableInstance, but a Config, so the name is a bit misleading.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thought I had fixed this but it turned out the commit was still sitting on a local copy. Also changed to config.

measurement = measureTotalUnassociatedDiaObjects(
dbCursor, "ap_association.totalUnassociatedDiaObjects")
ppdb, "association.totalUnassociatedDiaObjects")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed a rebase, because the correct namespace is ap_association.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm guessing that's what happened. I'll change it to the correct namespace.

config.associator.level1_db.db_name = workspace.dbLocation

# ApVerify will use the sqlite hooks for the Ppdb.
config.ppdb.db_url = "sqlite:///" + workspace.dbLocation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is that part that made you ask about whether the path was absolute or relative. I take it something like "sqlite:///workspace/output/association.db" gets resolved as a relative and not an absolute path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. sqlite:/// is always relative path so the above example works. If workspace is an absolute path with the added / at the beginning it "should" resolve to the correct absolute path.

if subSchema.getField().getTypeString() == "Angle":
continue
elif subSchema.getField().getTypeString() == "String":
src[subSchema.getField().getName()] = 'g'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a while to figure out that you're assuming this is a filter field; might want to explicitly say that.

for diaObject in self.diaObjects:
diaObject['nDiaSources'] = 1

self.butler = NonCallableMock(spec=dafPersist.Butler, get=mockGet)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please keep the NonCallableMock and mockGet definitions together? It's more confusing with the unrelated self.diaObjects definition in between.

config=self.ppdbCfg,
afw_schemas=dict(DiaObject=make_dia_object_schema(),
DiaSource=make_dia_source_schema()))
self.ppdb._schema.makeSchema()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.ppdb._schema.makeSchema()
self.ppdb.makeSchema(drop=True)

@@ -184,7 +185,8 @@ def testValidFromMetadata(self):
meas.metric_name,
lsst.verify.Name(
metric='association.fracUpdatedDIAObjects'))
self.assertEqual(meas.quantity, nUnassociatedDiaObjects * u.count)
self.assertEqual(meas.quantity,
nUnassociatedDiaObjects * u.count)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add a line break here? The original line was only 75 characters...

@@ -308,11 +306,9 @@ def testNoMetric(self):
metricName='foo.bar.FooBar')

# Fake DB handle to avoid DB initialization overhead
cursor = NonCallableMock(spec=sqlite3.Cursor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is obsolete, since you deleted the fake.

Fix typo in Ppdb import

Fix import bug
Fix measement unit type.
Fix linting error.

Fix call to db config field.

Fix custom config test.

Add READ_UNCOMMITTED to ap_verify defaults.

Fix docstring

Remove old comment.

Remove line break.
Change ordering of mockGet and mock butler.
Change name from configurable to config.

Correct metric namespace.
@morriscb morriscb merged commit 2560d47 into master Nov 30, 2018
@kfindeisen kfindeisen deleted the tickets/DM-15588 branch December 10, 2020 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants