kafka_connector.timer¶
-
class
kafka_connector.timer.Begin¶ Bases:
enum.EnumVariables: - IMMEDIATELY – 1
- FULL_CENTISECOND – 2
- FULL_DECISECOND – 3
- FULL_SECOND – 4
- FULL_MINUTE – 5
- FULL_HOUR – 6
-
class
kafka_connector.timer.Timer(timer_function, interval=1, unit=<Unit.SECOND: 2>, begin=<Begin.FULL_SECOND: 4>)¶ Bases:
objectRuns a predefined function every given interval
-
__init__(timer_function, interval=1, unit=<Unit.SECOND: 2>, begin=<Begin.FULL_SECOND: 4>)¶ Parameters: - timer_function (callable) – function which is called every interval step
- interval (int) – interval step
- unit (
Unit) – unit for interval - begin (None or
Beginor list ofdatetime.time) – Set start point. Either choose None for starting immediately,kafka_connector.timer.Beginelements or a list ofdatetime.timeincluding start times. In the third case, the start time is set to the time which is the closest from the current timestamp.
-
__weakref__¶ list of weak references to the object (if defined)
-
start()¶ Start timer and repeat calling
self.timer_functioneveryself.interval
-
stop()¶ Sets loop condition to false and timer loop will break in the next iteration. The current call of the
timer_functionwill not be aborted.
-