whylogs.api.logger.experimental.logger.actor.time_util#

Module Contents#

Classes#

TimeGranularity

Generic enumeration.

Schedule

FunctionTimer

A timer that executes a function repeatedly given a Schedule. It will execute at the bottom of

Functions#

current_time_ms(→ int)

truncate_time_ms(→ int)

whylogs.api.logger.experimental.logger.actor.time_util.current_time_ms() int#
Return type

int

class whylogs.api.logger.experimental.logger.actor.time_util.TimeGranularity#

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

Second = 'Second'#
Minute = 'Minute'#
Hour = 'Hour'#
Day = 'Day'#
Month = 'Month'#
Year = 'Year'#
name()#

The name of the Enum member.

value()#

The value of the Enum member.

whylogs.api.logger.experimental.logger.actor.time_util.truncate_time_ms(t: int, granularity: TimeGranularity) int#
Parameters
Return type

int

class whylogs.api.logger.experimental.logger.actor.time_util.Schedule#
cadence: TimeGranularity#
interval: int#
class whylogs.api.logger.experimental.logger.actor.time_util.FunctionTimer(schedule: Schedule, fn: Callable[[], Any], timer_class: Type[Any] = Timer)#

A timer that executes a function repeatedly given a Schedule. It will execute at the bottom of that time period. For example, a schedule of Schedule(TimeGranularity.Hour, 1) will execute at the start of each hour. If you start the timer 5 minutes before the next hour then it will first execute in five minutes, and then each hour after that.

Parameters
  • schedule (Schedule) –

  • fn (Callable[[], Any]) –

  • timer_class (Type[Any]) –

is_alive() bool#
Return type

bool

stop() None#
Return type

None