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-35396: Add provenance hooks for datastore to use #1147

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

timj
Copy link
Member

@timj timj commented Jan 23, 2025

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes
  • (if changing dimensions.yaml) make a copy of dimensions.yaml in configs/old_dimensions

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 92.04545% with 7 lines in your changes missing coverage. Please review.

Project coverage is 89.47%. Comparing base (3a57374) to head (afb16c5).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
python/lsst/daf/butler/_dataset_provenance.py 76.66% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1147   +/-   ##
=======================================
  Coverage   89.47%   89.47%           
=======================================
  Files         366      367    +1     
  Lines       49115    49185   +70     
  Branches     5955     5960    +5     
=======================================
+ Hits        43944    44007   +63     
- Misses       3753     3759    +6     
- Partials     1418     1419    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

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

Looks great, a couple of questions.

@@ -453,11 +454,11 @@ def dimensions(self) -> DimensionUniverse:
# Docstring inherited.
return self._dimensions

def put(self, obj: Any, ref: DatasetRef, /) -> DatasetRef:
def put(self, obj: Any, ref: DatasetRef, /, provenance: DatasetProvenance | None = None) -> DatasetRef:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def put(self, obj: Any, ref: DatasetRef, /, provenance: DatasetProvenance | None = None) -> DatasetRef:
def put(self, obj: Any, ref: DatasetRef, /, *, provenance: DatasetProvenance | None = None) -> DatasetRef:

to make it consistent with LimitedButler?

def put(self, inMemoryDataset: Any, datasetRef: DatasetRef) -> None:
def put(
self, inMemoryDataset: Any, datasetRef: DatasetRef, provenance: DatasetProvenance | None = None
) -> None:
raise NotImplementedError("This is a no-op datastore that can not access a real datastore")

def put_new(self, in_memory_dataset: Any, ref: DatasetRef) -> Mapping[str, DatasetRef]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, we should probably drop put_new if we are not using it. It's not tested and is probably broken already. Not on this ticket, of course.

@@ -169,6 +174,7 @@ def __init__(
ref: DatasetRef,
write_parameters: Mapping[str, Any] | None = None,
write_recipes: Mapping[str, Any] | None = None,
provenance: DatasetProvenance | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it need to be a constructor argument, could you pass it to write instead?

Comment on lines +84 to +86
if dataset_id not in self.extras:
self.extras[dataset_id] = {}
self.extras[dataset_id].update(extra)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe

self.extras.setdefault(dataset_id, {}).update(extra)

?

@timj timj force-pushed the tickets/DM-35396 branch from bcdbff4 to 37dd1a7 Compare January 31, 2025 21:27
@timj timj force-pushed the tickets/DM-35396 branch from f6b4efc to afb16c5 Compare January 31, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants