No project description provided
Project description
Lemonrunner
Run this forever and stream the results.
The entry point is the Definitively-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 Definitively-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
File details
Details for the file lemonrunner-0.1.linux-x86_64.tar.gz.
File metadata
- Download URL: lemonrunner-0.1.linux-x86_64.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
594731d03789d9ac9ed79680c8ae3e99cd5d6643fddacbfd057028c4bd1dc38c
|
|
| MD5 |
efbfeb6aac5038e3e6671bfc98de8fda
|
|
| BLAKE2b-256 |
d58fe5ae712e58524528bb2d77ee63f184121c228ea1e4b77838c71ec7f2aaef
|