chewie.timer_scheduler module

Homebrew Event scheduler, as sched.scheduler was not working outside of unittests

class chewie.timer_scheduler.TimerJob(expiry_time, func, args)

Bases: object

Represents a job for TimerScheduler, same api as asyncio.TimerHandle

args = None
cancel()

Cancel the callback.

cancelled()
Returns:

True if callback was cancelled

expiry_time = 0
func = None
is_cancelled = False
when()
Returns:

scheduled callback time as float seconds

class chewie.timer_scheduler.TimerScheduler(logger, sleep=None)

Bases: object

wraps a heapbased queue with a similar api to asyncio.loop

call_later(timeout, func, *args)

Scheduler callback.

Args:

timeout: number of seconds to delay executing func func: function to execute *args: arguments for func

Returns:

tuple (expiry_time, dict) - can be used for cancelling the job

run()

Main loop. should run forever