pyfarm.agent.tasks module¶
Tasks¶
Simple tasks which are run at a scheduled interval by ScheduledTaskManager
- class pyfarm.agent.tasks.ScheduledTaskManager[source]¶
Bases: object
Manages and keeps track of several scheduled tasks.
- test_clock = None¶
- register(function, interval, start=False, clock=None, func_args=None, func_kwargs=None)[source]¶
Register a callable function to run at a given interval. This function will do nothing if function has already been registered.
Parameters: - function – a callable function that should be run on an interval
- interval (int or float) – the interval in which function should be urn
- start (bool) – if True, start the interval timer after it has been added
- clock – optional keyword that will replace the looping call’s clock
- func_args (tuple) – the positional arguments to pass into function
- func_kwargs (dict) – the keyword arguments to pass into function
Raises AssertionError: raised if function is not callable
- start(now=True)[source]¶
start all LoopingCall instances stored from register()
- stop()[source]¶
stop all LoopingCall instances stored from register()