kafka_connector.timer¶
-
class
kafka_connector.timer.
Begin
¶ Bases:
enum.Enum
Variables: - 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:
object
Runs 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
Begin
or list ofdatetime.time
) – Set start point. Either choose None for starting immediately,kafka_connector.timer.Begin
elements or a list ofdatetime.time
including 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_function
everyself.interval
-
stop
()¶ Sets loop condition to false and timer loop will break in the next iteration. The current call of the
timer_function
will not be aborted.
-