About
A simple util library for creating applications which needs to keep running, despite abnormalities
Installing
pip install pyrobustness
Usage
Timeout example:
from robust.tools import timeout
@timeout(5)
def very_long_job():
import time
while True:
print("Zzz")
time.sleep(1)
very_long_job()
Retry example:
from robust.tools import retry
@retry(5)
def very_broken_method():
print(".")
raise RuntimeError("Something is broken...")
while True:
very_broken_method()
Circuit Breaker example:
import time
from robust.tools import breaker
counter = 0
@breaker(limit=5, revive=5)
def very_broken_method():
nonlocal counter
if counter <= 5:
counter += 1
raise RuntimeError("Something is broken...")
else:
print("We've made it!")
while True:
try:
very_broken_method()
except RuntimeError:
pass
except Exception:
break
time.sleep(5)
very_broken_method()
Version History
- 1.1:
- Additional type for alarm - threading to support Windows OS, or certain cases when signal is not working as supposed
- CircuitBreaker pattern, inspired by speech by Daniel Riti @Pycon 2016
- 1.0: Initial version
Metadata
Release files for pyrobustness 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrobustness-1.1.2.tar.gz | 3.5 kB | Without provenance | Details for pyrobustness-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyrobustness-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for pyrobustness-1.1.2-py3-none-any.whl |
Total release size: 8.9 kB
Release files / pyrobustness-1.1.2.tar.gz
| Download URL | pyrobustness-1.1.2.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0aeed1e808aea7320cde4cb0191c8c17d94fecfa5f192f64cfa8a999bc397779
|
|
BLAKE2b-256 checksum How to use checksums |
e0df5f80b9eea8360c3a37db211cf91ba154810339abc4adcc1bcb23dc3b3422
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Release files / pyrobustness-1.1.2-py3-none-any.whl
| Download URL | pyrobustness-1.1.2-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce74daa3e528e65fe083170e3672f53482f9cfe5dabc41485eb1351382ac0e8e
|
|
BLAKE2b-256 checksum How to use checksums |
27899d487e513136bde56e70ab436a4edbc207a0b5d28340dd85cb96d328e152
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for pyrobustness 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.