kamma
kamma is a very simplified task file queue that persists tasks and its needed data. It also has a worker that process all pending tasks.
Motivation
Nowadays local disk access is an undervalued resource for many reasons, however stored data is always available even after power outage. By contrast, network resources or remote third parties are not always ready. Is for this reason I developed the kamma in order to isolate dependent tasks from the miseries of remote services. kamma would try process all pending tasks forever respecting the queue order.
Limitations
Up to (sys.maxint - FileQue.max_head_index) tasks can be queued as maximum.
All task’s arguments should be serializable by json
Not recommended for high performance scenarios.
Install
As simple as:
pip install kamma
Example
import kamma
# python 2 and 3 compatibility issue
try:
input = raw_input
except NameError:
pass
# kamma worker
app = kamma.Worker()
# registering fibonacci callback in kamma app
@app.task_callback(timeout=5, retry_wait=kamma.wait_fixed(1),
retry_stop=kamma.stop_after_attempt(1))
def fibonacci(n, level=0):
result = 1
if n < 0 or n > 100:
raise kamma.AbortTask("n has to be 0 <= n <= 100")
if n > 1:
result = fibonacci(n - 1, level=level + 1) + fibonacci(n - 2, level=level + 1)
if level == 0:
print("*** RESULT: fibonacci of '{}' is '{}' ***".format(n, result))
return result
if __name__ == "__main__":
# start listening for incoming tasks
app.run_async()
print("Enter the value of the fibonacci you want to compute, 0 to exit")
n = 1
while True:
n = int(input(""))
if n == 0:
break
# add new fibonacci task
app.push_task(fibonacci, n=n)
app.stop()
The complete example here: examples/example.py
Metadata
Release files for kamma 0.0.10
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 |
|---|---|---|---|---|
| kamma-0.0.10.tar.gz | 7.7 kB | Without provenance | Details for kamma-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kamma-0.0.10-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for kamma-0.0.10-py2.py3-none-any.whl |
Total release size: 18.0 kB
Release files / kamma-0.0.10.tar.gz
| Download URL | kamma-0.0.10.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebb741ee6b83c00e6529446a999960582d0cb0046345ab81da948bd8167e2828
|
|
BLAKE2b-256 checksum How to use checksums |
597bd51cfe53aa86f4c7156238ce57bfd0927645679cabe471b3020a3d9f7486
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / kamma-0.0.10-py2.py3-none-any.whl
| Download URL | kamma-0.0.10-py2.py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6f59ebd5f65d913f4bc02fe7ba5ff46214e23a76bf1f0a7d1613cd64b618c6e8
|
|
BLAKE2b-256 checksum How to use checksums |
b5ab3114ccf83ee6cc4ce634da9962a0a64d11786a10b02607dfe859199e347a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for kamma 0.0.10
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.