File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 2222
2323from airbyte_cdk .connector import TConfig
2424from airbyte_cdk .exception_handler import init_uncaught_exception_handler
25- from airbyte_cdk .logger import init_logger
25+ from airbyte_cdk .logger import PRINT_BUFFER , init_logger
2626from airbyte_cdk .models import (
2727 AirbyteConnectionStatus ,
2828 AirbyteMessage ,
@@ -337,11 +337,11 @@ def launch(source: Source, args: List[str]) -> None:
337337 parsed_args = source_entrypoint .parse_args (args )
338338 # temporarily removes the PrintBuffer because we're seeing weird print behavior for concurrent syncs
339339 # Refer to: https://github.com/airbytehq/oncall/issues/6235
340- # with PrintBuffer() :
341- for message in source_entrypoint .run (parsed_args ):
342- # simply printing is creating issues for concurrent CDK as Python uses different two instructions to print: one for the message and
343- # the other for the break line. Adding `\n` to the message ensure that both are printed at the same time
344- print (f"{ message } \n " , end = "" , flush = True )
340+ with PRINT_BUFFER :
341+ for message in source_entrypoint .run (parsed_args ):
342+ # simply printing is creating issues for concurrent CDK as Python uses different two instructions to print: one for the message and
343+ # the other for the break line. Adding `\n` to the message ensure that both are printed at the same time
344+ print (f"{ message } \n " , end = "" )
345345
346346
347347def _init_internal_request_filter () -> None :
Original file line number Diff line number Diff line change 1616 Level ,
1717 Type ,
1818)
19+ from airbyte_cdk .utils import PrintBuffer
1920from airbyte_cdk .utils .airbyte_secrets_utils import filter_secrets
2021
22+ PRINT_BUFFER = PrintBuffer (flush_interval = 0.1 )
23+
2124LOGGING_CONFIG = {
2225 "version" : 1 ,
2326 "disable_existing_loggers" : False ,
2730 "handlers" : {
2831 "console" : {
2932 "class" : "logging.StreamHandler" ,
30- "stream" : "ext://sys.stdout" ,
33+ "stream" : PRINT_BUFFER ,
3134 "formatter" : "airbyte" ,
3235 },
3336 },
You can’t perform that action at this time.
0 commit comments