IO 運算子¶
這些運算子對檔案系統或物件儲存執行各種操作。
傳輸檔案¶
使用 FileTransferOperator 將檔案從一個位置複製到另一個位置。該運算子的引數如下:
src- 來源路徑,str 或 ObjectStoragePath 型別dst- 目標路徑,str 或 ObjectStoragePath 型別src_conn_id- 來源連線 ID(預設值:None)dst_conn_id- 目標連線 ID(預設值:None)overwrite- 是否覆蓋目標(預設值:False)
如果 src 和 dst 都位於同一個物件儲存中,則將在物件儲存中執行復制。否則,資料將從來源流式傳輸到目標。
下面的示例展示瞭如何例項化 FileTransferOperator 任務。
tests/system/common/io/example_file_transfer_local_to_s3.py
transfer = FileTransferOperator(src=temp_file_path, dst=AWS_BUCKET, task_id="transfer")