File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1- import boto3
2- from pathlib import Path
3- import numpy as np
41import logging
2+ from pathlib import Path
53import sys
4+ from time import time
5+
6+ import boto3
7+ import numpy as np
68
79from one .api import ONE
810from one .alf .files import add_uuid_string
1921# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html to set up
2022# credentials
2123
24+
2225class AWS :
2326 def __init__ (self , s3_bucket_name = None , one = None ):
2427 # TODO some initialisation routine to set up credentials for the first time
@@ -50,8 +53,10 @@ def _download_datasets(self, datasets):
5053 # probably better to do filter on collection ? Not for today
5154 objects = list (self .bucket .objects .filter (Prefix = aws_path ))
5255 if len (objects ) == 1 :
56+ ts = time ()
5357 _logger .info (f'Downloading { aws_path } to { file_path } ' )
5458 self .bucket .download_file (aws_path , file_path )
59+ _logger .debug (f'Complete. Time elapsed { time () - ts } for { file_path } ' )
5560 else :
5661 _logger .warning (f'{ aws_path } not found on s3 bucket: { self .bucket .name } ' )
5762
Original file line number Diff line number Diff line change 1+ boto3
12click >= 7.0.0
23colorlog >= 4.0.2
34flake8 >= 3.7.8
You can’t perform that action at this time.
0 commit comments