Skip to content

Commit

Permalink
fix delete
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan King committed Feb 12, 2024
1 parent 1669418 commit a9fdadd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hail/python/hailtop/aiotools/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ async def delete(paths: Iterator[str]) -> None:
async with sema:
with SimpleCopyToolProgressBar(description='files', transient=True, total=0) as file_pbar:
listener = file_pbar.make_listener()

async def remove(path):
try:
await fs.remove(path)
except FileNotFoundError:
await fs.rmtree(sema, path, listener=listener)

for grouped_paths in grouped(5_000, paths):
await asyncio.gather(*[fs.rmtree(sema, path, listener=listener) for path in grouped_paths])
await asyncio.gather(*[remove(path) for path in grouped_paths])


async def main() -> None:
Expand Down

0 comments on commit a9fdadd

Please sign in to comment.