Skip to content

[Data] Make file IO retry budgets and error patterns configurable - #68290

Open
dragongu wants to merge 3 commits into
ray-project:masterfrom
dragongu:data-io-retry-config
Open

dragongu wants to merge 3 commits into
ray-project:masterfrom
dragongu:data-io-retry-config

Conversation

@dragongu

Copy link
Copy Markdown
Contributor

Description

Make shared file IO retry attempts configurable through DataContext and environment defaults, so applications can tune retry budgets for their storage backend. Explicitly propagate footer retry configuration to Parquet V2 actors.

Before

Shared file and Parquet retry wrappers used fixed budgets of 10 attempts. retried_io_errors was configurable through DataContext, but its default had no environment override. FooterReader actors used default error patterns rather than the configuration captured for the read.

After

  • Add DataContext.io_retry_max_attempts, defaulting to RAY_DATA_IO_RETRY_MAX_ATTEMPTS or 10. Attempts include the initial try.
  • Use the budget in shared filesystem wrappers, file stream reads, file writes, and the updated Parquet V1/V2 retry paths. Explicit budgets and independent connector retry settings retain precedence; this is not a task-wide or SDK retry limit.
  • Allow JSON-array replacement of default patterns through RAY_DATA_RETRIED_IO_ERRORS. The deprecated write-only defaults have a separate RAY_DATA_WRITE_FILE_RETRY_ON_ERRORS override. Empty arrays are preserved, and existing default patterns, including the S3 HeadBucket pattern, are unchanged.
  • Capture footer retry attempts and a copy of the error list when constructing FooterFileIndexer, then pass them to FooterReader actors. Actors use their captured configuration rather than their process-local DataContext.

Subsystems: API (DataContext configuration); IO (datasource/datasink retry behavior).

@dragongu
dragongu requested review from a team as code owners November 18, 2026 04:01
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 69419cc. Configure here.

@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Nov 18, 2026

@Yin-1022 Yin-1022 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed one related retry path outside the files changed in this PR that might also be worth covering.

In python/ray/data/_internal/datasource_v2/formats/text/text_reader.py, TextReader.read() uses the shared iterate_with_retry() helper but doesn't pass max_attempts, so it continues to use the default of 10 attempts regardless of the new DataContext.io_retry_max_attempts setting.

I verified this with a small regression test using io_retry_max_attempts=1 and 3. Both cases failed with assert 10 == 1 and assert 10 == 3, respectively. After adding max_attempts=ctx.io_retry_max_attempts to the call, both tests passed.

Since this PR introduces configurable retry budgets for file IO, would it make sense to cover this path as well, or is the TextReader retry path intentionally outside the scope of this change? Not a blocker by the way. If this is intentionally outside the scope of this PR, perhaps it could be tracked in a follow-up issue to ensure consistent retry budget behavior across the other file readers as well.

@dragongu
dragongu force-pushed the data-io-retry-config branch from 0210d2a to a4aa772 Compare November 19, 2026 03:10
@dragongu
dragongu requested review from a team as code owners November 19, 2026 03:10
@dragongu
dragongu force-pushed the data-io-retry-config branch from a4aa772 to 37f50bb Compare November 19, 2026 03:24
@dragongu

Copy link
Copy Markdown
Contributor Author

I noticed one related retry path outside the files changed in this PR that might also be worth covering.

In python/ray/data/_internal/datasource_v2/formats/text/text_reader.py, TextReader.read() uses the shared iterate_with_retry() helper but doesn't pass max_attempts, so it continues to use the default of 10 attempts regardless of the new DataContext.io_retry_max_attempts setting.

I verified this with a small regression test using io_retry_max_attempts=1 and 3. Both cases failed with assert 10 == 1 and assert 10 == 3, respectively. After adding max_attempts=ctx.io_retry_max_attempts to the call, both tests passed.

Since this PR introduces configurable retry budgets for file IO, would it make sense to cover this path as well, or is the TextReader retry path intentionally outside the scope of this change? Not a blocker by the way. If this is intentionally outside the scope of this PR, perhaps it could be tracked in a follow-up issue to ensure consistent retry budget behavior across the other file readers as well.

@Yin-1022 Thanks for catching this, has fixed

Comment thread python/ray/data/context.py Resolved
Add DataContext.io_retry_max_attempts and environment defaults for shared
file IO retry attempts and error patterns. The default budget remains
10 total attempts. Retry transient S3 HTTP 429 responses by default.

File reads, writes, schema inference, and checkpoint IO now use the
configured budget. Parquet V2 forwards captured retry configuration to
FooterReader actors. Zarr captures its budget when creating read tasks,
including when an explicit context differs from the current context.

Keep the deprecated write_file_retry_on_errors configuration unchanged.
Document the new budget and cover environment parsing, retry counts,
configuration propagation, S3 error matching, and Zarr context capture.

Full Ray integration tests have not run: the workspace lacks the source
ray._raylet extension. Source-isolated regression checks were run.

Signed-off-by: dragongu <[email protected]>
Add ray._common.utils.env_tuple() alongside env_bool/env_integer/env_float
and use it for RAY_DATA_RETRIED_IO_ERRORS instead of the local
_env_retry_errors helper.

Consolidate the retry configuration tests: cover attempts and error
patterns for the default and set cases, keep the end-to-end error tests,
and use DataContext.get_current() rather than comparing global and local
contexts in the Zarr test.

Signed-off-by: dragongu <[email protected]>
The local-variable binding only silenced the local pre-commit pyrefly hook,
which runs without pyarrow installed. CI type-checks with pyarrow and passes
on the original code.

Signed-off-by: dragongu <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants