Skip to content

Commit

Permalink
Fix transfer config import (spotify#2458)
Browse files Browse the repository at this point in the history
* import TransferConfig instead of full boto3 module
  • Loading branch information
ouanixi authored and thisiscab committed Aug 8, 2018
1 parent aa77ba6 commit 4801460
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions luigi/contrib/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,10 @@ def put_multipart(self, local_path, destination_s3_path, part_size=8388608, **kw
raise DeprecatedBotoClientException(
'encrypt_key deprecated in boto3. Please refer to boto3 documentation for encryption details.')

import boto3
from boto3.s3.transfer import TransferConfig
# default part size for boto3 is 8Mb, changing it to fit part_size
# provided as a parameter
transfer_config = boto3.s3.transfer.TransferConfig(
multipart_chunksize=part_size)
transfer_config = TransferConfig(multipart_chunksize=part_size)

(bucket, key) = self._path_to_bucket_and_key(destination_s3_path)

Expand Down Expand Up @@ -318,10 +317,9 @@ def copy(self, source_path, destination_path, threads=100, start_time=None, end_

# don't allow threads to be less than 3
threads = 3 if threads < 3 else threads
import boto3
from boto3.s3.transfer import TransferConfig

transfer_config = boto3.s3.transfer.TransferConfig(
max_concurrency=threads, multipart_chunksize=part_size)
transfer_config = TransferConfig(max_concurrency=threads, multipart_chunksize=part_size)
total_keys = 0

if self.isdir(source_path):
Expand Down

0 comments on commit 4801460

Please sign in to comment.