mosaicml / mosaicml/streaming

dataframe_to_mds fails on large datasets due to Worker Disk Exhaustion

Open
#970 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.6k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

Issue Description

Calling dataframe_to_mds on a large Spark DataFrame leads to worker disk exhaustion: no space left of disk. This happens when a remote path is provided in the out argument of mds_kwargs.

Following is the code snippet I had used:

train_df = spark.read.parquet(train_data_path)

# remote output path
train_shard_path = "gs://<bucket_name><prefix>/train"

mds_kwargs = {
    'out': train_shard_path,
    'columns': {
        'X': 'int64',
        'Y': 'ndarray:float32',
        'A': 'int64',
        'B': 'ndarray:float32',
        'C': 'ndarray:int64',
        'D': 'ndarray:float32'
    },
    'compression': 'zstd',
    'hashes': ['sha1'],
    'keep_local': False 
}


mds_path = dataframe_to_mds(
    train_df,
    merge_index=True,
    mds_kwargs=mds_kwargs
)

The current implementation is dependent on the worker's disk space (or shared volume size). If the worker disk space is less than the total size of the dataset (dataframe) then the dataframe_to_mds method crashes as the workers run out of disk space.

Environment

  • OS: [Ubuntu 20.04]
  • Spark version: 3.5

Expected behavior

The dataframe_to_mds function should be able to process datasets of any size, limited only by remote storage capacity rather than local worker disk or driver memory.

Contributor guide

Open the contributing guide

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 at the dataframe_to_mds entry point and reproduce the failure with a large Spark DataFrame, a remote out path, merge_index=True, and keep_local=False. Trace how worker disk and remote output are used; done means processing is no longer limited by local worker disk or driver memory, subject to remote storage capacity.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, spark
Domain
data-engineering
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.