fsspec / fsspec/filesystem_spec

Removing large zarr stores recursively blows up memory

Open
#690 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

I am trying to remove a rather large zarr store from the pangeo scratch bucket:

I am doing this on the pangeo google deployment (production)

import fsspec
import os

fs = fsspec.filesystem('gcs')
print(fs.ls('pangeo-scratch/jbusecke/detrending_test/'))

for path in fs.ls('pangeo-scratch/jbusecke/detrending_test/'):
    fs.rm(path, recursive=True)
    print(f'Finished with {path}')

This will take some time, over which memory usage on the notebook process increases steadily and eventually the kernel crashes.

Is this a misuse of fsspec (I am very new to all of this).

Or is this a bug that might have a workaround? Any help to debug this would be greatly appreciated.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the notebook snippet with fsspec's gcs filesystem and the recursive fs.rm(path, recursive=True) call. Trace the recursive removal path while watching notebook-process memory; done means large zarr stores can be removed without steady memory growth or a kernel crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, python
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.