Cronus Implementation

Implementation withing cronus is divided into two modules: beat and timeout

beat

The beat module implements the fixed frequency feature

beat.set_rate(rate)

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
beat.true()

A substitute to True. Use ‘while beat.true()’ instead of ‘while True’

Returns:True
beat.sleep()

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()
class beat.BeatError(msg)

timeout

The timeout module implements, obviously, the timeout feature

timeout.timeout(duration)

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

class timeout.TimeoutError

Thrown by @timeout decorator when the external function exceeds the timeout duration

Cronus

Navigation