No project description provided
Project description
Lemonrunner
Run this forever and stream the results.
The entry point is the Lemonrunner-class, which exposes the run-method. Run takes an id, a function, and optional key-word arguments for args, kwargs, timeout, times and interval.
Any function passed to run will be run either forever, or N times, if the times arument is given. Returns, yielded values or exceptions are all retrieved from the monitor-method.
The monitor function of the Lemonrunner-class is a generator which yields each message from each function as they come in.
Example
from time import sleep
from lemonrunner import Lemonrunner
def foo():
raise ValueError
def bar():
sleep(3)
return 5
def baaz():
yield 'abc'
runner = Lemonrunner()
runner.run('foo', foo, interval=1)
runner.run('bar', bar, interval=1, timeout=2)
runner.run('baaz', baaz, times=2)
for id, message_type, timestamp, return_value in runner.monitor():
print(id, message_type, timestamp, return_value)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lemonrunner-0.2.tar.gz
(3.8 kB
view details)
File details
Details for the file lemonrunner-0.2.tar.gz.
File metadata
- Download URL: lemonrunner-0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2829429c97e209de4ae1c16d278b0a4f1bec3e66aead4592e0099f5fdd673ba9
|
|
| MD5 |
d6424f32f9fc26bf14dad043b0b4a947
|
|
| BLAKE2b-256 |
02f77c01e0a8fd1f5c63cd1da04f2a44ff9505ff6facda0ab0bced865c558d98
|