@@ -24,7 +24,7 @@ def connect(self, spark: SparkSession) -> None:
2424 port = self .connection_dto .port ,
2525 user = self .connection_dto .user ,
2626 password = self .connection_dto .password ,
27- compress = False ,
27+ compress = False , # to avoid errors from combining file and SCP-level compression
2828 ).check ()
2929 self .local_connection = SparkLocalFS (
3030 spark = spark ,
@@ -36,16 +36,14 @@ def read(self) -> DataFrame:
3636 downloader = FileDownloader (
3737 connection = self .connection ,
3838 source_path = self .transfer_dto .directory_path ,
39- temp_path = "/tmp/syncmaster" ,
40- local_path = "/tmp/syncmaster/sftp" ,
41- options = {"if_exists" : "replace_entire_directory" },
39+ local_path = self .transfer_dto .temp_worker_directory_path ,
4240 )
4341 downloader .run ()
4442
4543 reader = FileDFReader (
4644 connection = self .local_connection ,
4745 format = self .transfer_dto .file_format ,
48- source_path = "/tmp/syncmaster/sftp" ,
46+ source_path = self . transfer_dto . temp_worker_directory_path ,
4947 df_schema = StructType .fromJson (self .transfer_dto .df_schema ) if self .transfer_dto .df_schema else None ,
5048 options = self .transfer_dto .options ,
5149 )
@@ -65,16 +63,14 @@ def write(self, df: DataFrame) -> None:
6563 writer = FileDFWriter (
6664 connection = self .local_connection ,
6765 format = self .transfer_dto .file_format ,
68- target_path = "/tmp/syncmaster/sftp" ,
66+ target_path = self . transfer_dto . temp_worker_directory_path ,
6967 options = self .transfer_dto .options ,
7068 )
7169 writer .run (df = df )
7270
7371 uploader = FileUploader (
7472 connection = self .connection ,
75- local_path = "/tmp/syncmaster/sftp" ,
76- temp_path = "/config/target" , # SFTP host
73+ local_path = self .transfer_dto .temp_worker_directory_path ,
7774 target_path = self .transfer_dto .directory_path ,
78- options = {"if_exists" : "replace_entire_directory" },
7975 )
8076 uploader .run ()
0 commit comments