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-28857 sort collections before pruning in butler prune-collection #487

Merged
merged 1 commit into from Mar 25, 2021

Conversation

n8pease
Copy link
Contributor

@n8pease n8pease commented Mar 8, 2021

For @TallJimbo, seeing if this approach will work. I'm leaving more notes in the ticket.

@n8pease n8pease force-pushed the tickets/DM-28857 branch 4 times, most recently from 399e72f to 0832300 Compare March 11, 2021 18:58
@@ -1156,7 +1156,8 @@ def datasetExists(self, datasetRefOrType: Union[DatasetRef, DatasetType, str],
ref = self._findDatasetRef(datasetRefOrType, dataId, collections=collections, **kwds)
return self.datastore.exists(ref)

def pruneCollection(self, name: str, purge: bool = False, unstore: bool = False) -> None:
def pruneCollection(self, name: str, purge: bool = False, unstore: bool = False,
unlink: Optional[str] = None) -> None:
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
unlink: Optional[str] = None) -> None:
unlink: Optional[List[str]] = None) -> None:

@@ -1176,6 +1177,9 @@ def pruneCollection(self, name: str, purge: bool = False, unstore: bool = False)
unstore: `bool`, optional
If `True`, remove all datasets in the collection from all
datastores in which they appear.
unlink: `list` [`str`]
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
unlink: `list` [`str`]
unlink: `list` [`str`], optional


if (unlink):
for parent in unlink:
remove(name, parent)
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 we should move this down into the transaction block so the whole thing stays exception-safe.

@n8pease n8pease merged commit e1aa3b3 into master Mar 25, 2021
@n8pease n8pease deleted the tickets/DM-28857 branch March 25, 2021 18:23
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.

None yet

2 participants