28
28
from enum import Enum , auto
29
29
from typing import IO , TYPE_CHECKING , Any , Literal , cast
30
30
31
- import pendulum
32
31
from rich .errors import LiveError
33
32
from rich .live import Live as RichLive
34
33
from rich .markdown import Markdown as RichMarkdown
35
34
35
+ from airbyte_cdk .utils .datetime_helpers import ab_datetime_now
36
36
from airbyte_protocol .models import (
37
37
AirbyteMessage ,
38
38
AirbyteStreamStatus ,
@@ -410,7 +410,8 @@ def _send_telemetry(
410
410
def _log_sync_start (self ) -> None :
411
411
"""Log the start of a sync operation."""
412
412
self ._print_info_message (
413
- f"Started `{ self .job_description } ` sync at `{ pendulum .now ().format ('HH:mm:ss' )} `..."
413
+ f"Started `{ self .job_description } ` sync at "
414
+ f"`{ ab_datetime_now ().strftime ('%H:%M:%S' )} `..."
414
415
)
415
416
# We access a non-public API here (noqa: SLF001) to get the runtime info for participants.
416
417
self ._send_telemetry (
@@ -423,13 +424,14 @@ def log_stream_start(self, stream_name: str) -> None:
423
424
if stream_name not in self .stream_read_start_times :
424
425
self ._print_info_message (
425
426
f"Read started on stream `{ stream_name } ` at "
426
- f"`{ pendulum . now ().format ( 'HH:mm:ss ' )} `..."
427
+ f"`{ ab_datetime_now ().strftime ( '%H:%M:%S ' )} `..."
427
428
)
428
429
self .stream_read_start_times [stream_name ] = time .time ()
429
430
430
431
def _log_stream_read_end (self , stream_name : str ) -> None :
431
432
self ._print_info_message (
432
- f"Read completed on stream `{ stream_name } ` at `{ pendulum .now ().format ('HH:mm:ss' )} `..."
433
+ f"Read completed on stream `{ stream_name } ` at "
434
+ f"`{ ab_datetime_now ().strftime ('%H:%M:%S' )} `..."
433
435
)
434
436
self .stream_read_end_times [stream_name ] = time .time ()
435
437
@@ -535,7 +537,8 @@ def log_success(
535
537
self ._update_display (force_refresh = True )
536
538
self ._stop_rich_view ()
537
539
self ._print_info_message (
538
- f"Completed `{ self .job_description } ` sync at `{ pendulum .now ().format ('HH:mm:ss' )} `."
540
+ f"Completed `{ self .job_description } ` sync at "
541
+ f"`{ ab_datetime_now ().strftime ('%H:%M:%S' )} `."
539
542
)
540
543
self ._log_read_metrics ()
541
544
self ._send_telemetry (
@@ -552,7 +555,8 @@ def log_failure(
552
555
self ._update_display (force_refresh = True )
553
556
self ._stop_rich_view ()
554
557
self ._print_info_message (
555
- f"Failed `{ self .job_description } ` sync at `{ pendulum .now ().format ('HH:mm:ss' )} `."
558
+ f"Failed `{ self .job_description } ` sync at "
559
+ f"`{ ab_datetime_now ().strftime ('%H:%M:%S' )} `."
556
560
)
557
561
self ._send_telemetry (
558
562
state = EventState .FAILED ,
0 commit comments