← open_datasets
retry / backoff resiliencepython · communitycommunity · karma-rewarded● active

Retry Logic with Injected Sleep Backoff

sponsor: Platform
connect to contribute →

Each item is a retry logic with injected sleep backoff example providing Task description, Retry strategy type, Strategy description, Strategy parameters (curator-authored ground truth, JSON), Retry/backoff implementation (Python), Simulated dependency call script, Expected result (curator-computed ground truth, JSON). Favour realistic, self-contained cases; avoid duplicating public benchmark examples or trivial ones.

karma / item
60 karma
capacity reserved / target
242 / 5,000
final accepted
60
contributors
2
license
CC-BY-4.0
Karma per final accepted item

Secured after final acceptance. It is added to your balance when this pool publishes after its shared review window closes cleanly. Rejected items do not qualify.

secured on acceptance60 karma
Community terms

Platform-authored spec, open on delivery.

publishes tohugging face
licenseCC-BY-4.0
Quality signals

Measured pipeline stats for this dataset. A dash means the platform does not publish that measure for this pool.

submitted items242
rejected items0
duplicate rate30%
contributors2
validators1

// dataset_type_samples

Illustrative samples authored for the Retry / Backoff Resilience dataset type.

solution_code
def retry_call(dependency, sleep):
    max_attempts = 7
    failure_threshold = 3
    reset_timeout_seconds = 15
    attempts = 0
    state = "closed"
    fail_count = 0
    while True:
        if state in ("closed", "half_open"):
            if attempts >= max_attempts:
                raise RuntimeError("circuit breaker: max attempts exhausted")
            attempts += 1
            try:
                return dependency()
            except Exception:
                if state == "closed":
                    fail_count += 1
                    if fail_count >= failure_threshold:
                        state = "open"
                else:
                    state = "open"
                continue
        else:
            if attempts >= max_attempts:
                raise RuntimeError("circuit breaker: max attempts exhausted")
            sleep(reset_timeout_seconds)
            state = "half_open"
strategy_typecircuit_breaker
expected_result
{
  "outcome": "success",
  "final_attempts": 5,
  "delay_sequence": [
    15,
    15
  ]
}
strategy_params
{
  "failure_threshold": 3,
  "reset_timeout_seconds": 15,
  "max_attempts": 7
}
task_description
A web application checks out a connection from a pooled connection manager in front of a relational database. During a failover, the pool starts returning connection errors on nearly every checkout; a circuit breaker trips after a few consecutive failures so the application stops hammering the dying pool, waits, and periodically sends a single probing checkout to see whether the failover has completed.
dependency_behavior
[
  "fail",
  "fail",
  "fail",
  "fail",
  "succeed"
]
strategy_description
Circuit breaker: open the circuit after 3 consecutive failures, wait 15 seconds before each half-open trial, up to 7 real attempts total.

// sample_item

Approved public samples for this Retry / Backoff Resilience dataset. These are source artifacts attached to this program, not generated examples.

No public sample item is available for this dataset yet.
Ready to contribute to this dataset?
Contribute to this open pool. 60 karma is secured on each final acceptance and added to your balance after verified publication.
connect to contribute →