Skip to content

fix(reporting): Add retry logic and configurable chunk size for BigQuery writes#488

Merged
erinlimbogoogle merged 2 commits into
GoogleCloudPlatform:mainfrom
erinlimbogoogle:fix-evaluator-timeout
Jul 13, 2026
Merged

fix(reporting): Add retry logic and configurable chunk size for BigQuery writes#488
erinlimbogoogle merged 2 commits into
GoogleCloudPlatform:mainfrom
erinlimbogoogle:fix-evaluator-timeout

Conversation

@erinlimbogoogle

Copy link
Copy Markdown
Collaborator

Summary

This PR addresses transient BigQuery rate limit errors (specifically 429 TooManyRequests: too many table update operations) that occur when running large evaluation datasets or executing multiple evaluations concurrently.
It implements two main changes in BigQueryReporter:

  1. Configurable Chunk Size: Replaces the hardcoded chunk size of 250 with a configurable chunk_size parameter in the reporter config (defaulting to 500). Increasing the chunk size reduces the number of load jobs (table updates) generated per run.
  2. Transient Error Retries: Wraps the BigQuery load job in a retry loop with exponential backoff (up to 5 attempts, backing off by a factor of 2 starting at 2 seconds). It catches TooManyRequests (429) and ServiceUnavailable (503) errors, preventing temporary rate-limit spikes from failing the entire evaluation.

Changes

  • evalbench/reporting/bqstore.py:
    • Defined _DEFAULT_CHUNK_SIZE = 500.
    • Initialized self.chunk_size from reporting_config in BigQueryReporter.__init__.
    • Updated store to use self.chunk_size when splitting the results dataframe.
    • Added a retry loop around self.client.load_table_from_dataframe and job.result().

@google-cla

google-cla Bot commented Jul 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@erinlimbogoogle erinlimbogoogle force-pushed the fix-evaluator-timeout branch from 5607bac to 8774d02 Compare July 10, 2026 23:23
@erinlimbogoogle erinlimbogoogle changed the base branch from fix-evaluator-timeout to main July 10, 2026 23:26
@prernakakkar-google

Copy link
Copy Markdown
Collaborator

/gcbrun

chunk, table, job_config=job_config
)
job.result() # Wait for the job to complete.
# Retry loop for BQ load job to handle transient rate limits

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I wonder if we can use retry.Retry?

from google.api_core import retry
api_retry_strategy = retry.Retry(
    predicate=retry.if_exception_type(
        InternalServerError, 
        ServiceUnavailable, 
        TooManyRequests
    ),
    initial=2.0,   # Seconds to wait before the first retry
    multiplier=2.0, # Exponential backoff multiplier
    maximum=10.0,   # Maximum delay between retries
    timeout=60.0    # Stop retrying after this many total seconds
)
job.result(retry=api_retry_strategy) 

@erinlimbogoogle erinlimbogoogle merged commit 6b5f0a6 into GoogleCloudPlatform:main Jul 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants