-
Couldn't load subscription status.
- Fork 110
Set rm_files to be a synchronous method #503
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
78d8ba9
b62bb25
c54a64a
b8d09f3
cab1c15
915295c
ef84f97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1287,6 +1287,24 @@ async def _rm_files( | |
|
|
||
| sync_wrapper(_rm_files) | ||
|
|
||
| async def _rm_file(self, path: str, **kwargs): | ||
| """Delete a file. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| path: str | ||
| File to delete. | ||
| """ | ||
| container_name, p, _ = self.split_path(path) | ||
| try: | ||
| async with self.service_client.get_container_client( | ||
| container=container_name | ||
| ) as cc: | ||
| await cc.delete_blob(p) | ||
| except Exception as e: | ||
| raise RuntimeError("Failed to remove %s for %s", path, e) from e | ||
|
||
| self.invalidate_cache(self._parent(path)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Poking more through the adlfs codebase, I'm thinking we will also need to invalidate the fs = get_fs()
upload(fs)
print(fs.ls(f"{CONTAINER_NAME}/small.bin"))
fs.rm_file(f"{CONTAINER_NAME}/small.bin")
print("Still cached:", fs.ls(f"{CONTAINER_NAME}/small.bin")) # Should throw FileNotFoundErrorWe should make sure to add a test case for this as well. |
||
|
|
||
| async def _separate_directory_markers_for_non_empty_directories( | ||
| self, file_paths: typing.Iterable[str] | ||
| ) -> typing.Tuple[typing.List[str], typing.List[str]]: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martindurant question for you when you have the chance...
When using a
version_awarefile system and therm_file, should we be deleting versioned objects if the version is specified in the path (e.g.,data/root/a/file.txt?versionid=<some-verson-id>)? Azure Blob is similar to S3 in order to delete a version of the object/blob a version id must be provided to explicitly delete that version snapshot. It did not look likes3fsdid this for itsrm_fileimplementation but figured to ask.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anjaliratnam-msft I'm thinking we go ahead and support version ids that are supplied as part of the path for
rm_file. Specifically, I'm leaning this way because:version_idfromsplit_pathand provide it todelete_blob. Similar to how it's done inget_file()info(),open())We should also make sure we add a test for deleting versioned blobs as well.