in src/s3_util.py [0:0]
def upload_file(self, localpath, remote_path, quite_mode=False):
"""
Uploads a file to s3
:param quite_mode: If False, prints the status of each file downloaded
:param localpath: The local path
:param remote_path: The s3 path in format s3://mybucket/mydir/mysample.txt
"""
start = datetime.datetime.now()
bucket, key = self._get_bucketname_key(remote_path)
if key.endswith("/"):
key = "{}{}".format(key, os.path.basename(localpath))
s3 = boto3.client('s3')
s3.upload_file(localpath, bucket, key)
if not quite_mode:
download_time = datetime.datetime.now() - start
print("Uploading file {} to {} in {} seconds".format(localpath, remote_path, download_time.total_seconds()))