Implementation withing cronus is divided into two modules: beat and timeout
The beat module implements the fixed frequency feature
Defines the ideal rate at which computation is to be performed
| Parameters: | rate (int or float) – the frequency in Hertz |
|---|---|
| Raises: | TypeError: if argument ‘rate’ is not int or float |
A substitute to True. Use ‘while beat.true()’ instead of ‘while True’
| Returns: | True |
|---|
Sleeps for a dynamic duration of time as determined by set_rate() and true().
| Raises: | BeatError: if this function is called before calling set_rate() or before calling true() |
|---|
The timeout module implements, obviously, the timeout feature
A decorator to force a time limit on the execution of an external function.
| Parameters: | duration (int) – the timeout duration |
|---|---|
| Raises: | TypeError, if duration is anything other than integer |
| Raises: | ValueError, if duration is a negative integer |
:raises TimeoutError, if the external function execution crosses ‘duration’ time
Thrown by @timeout decorator when the external function exceeds the timeout duration