Request deadline budget tracking for distributed orchestrations
Project description
deadline-budget
Request deadline budget tracking for distributed orchestrations
Installation
pip install deadline-budget
Optional dependencies:
pip install deadline-budget[settings] # Pydantic-based settings
pip install deadline-budget[dishka] # Dishka DI provider
Requirements: Python 3.10+
Quick start
from deadline_budget import BudgetContext
# Define per-call timeout caps
call_caps = {
"identity_create_user": 3.0,
"credential_set_password": 3.0,
"verification_verify_code": 2.0,
}
# Create context with total budget (10s total, 0.5s safety margin = 9.5s usable)
ctx = BudgetContext.create(
total_seconds=10.0,
safety_margin=0.5,
min_timeout=0.1,
call_caps=call_caps,
)
# Get timeout for each call (uses specific cap or remaining budget)
await identity_service.create_user(..., timeout=ctx.timeout_for_call("identity_create_user"))
await credential_service.set_password(..., timeout=ctx.timeout_for_call("credential_set_password"))
await verification_service.confirm(..., timeout=ctx.timeout_for_call("verification_verify_code"))
# Check if budget exhausted
ctx.check_expired() # Raises DeadlineExceededError if expired
Documentation
Full documentation at bedrock-python.github.io/deadline-budget.
License
Apache 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deadline_budget-0.1.0.tar.gz
(11.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deadline_budget-0.1.0.tar.gz.
File metadata
- Download URL: deadline_budget-0.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54b2ce6c6c44392fba334cc5442957ab75a31b8407960b25a5d1025010ee8cf5
|
|
| MD5 |
3837a5e4271c1d53da76782a07569ab0
|
|
| BLAKE2b-256 |
1400d5b3171db0599902d0681202b9d80a4dc6e50f299129d48032cda19d9c88
|
File details
Details for the file deadline_budget-0.1.0-py3-none-any.whl.
File metadata
- Download URL: deadline_budget-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1284e11e039b22a74823dbecb43de03d9fe2663f851fe771a068a66e2cac1be5
|
|
| MD5 |
8c651f321d7b04ea1a4ce84803a62546
|
|
| BLAKE2b-256 |
e561e994ccb6dc83adad317d2e8e716d6b368e1d626c72fbedb7bc7f6888155a
|