File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 11"""The BMA CLI wrapper."""
2+ import time
23
34import json
45import logging
@@ -109,10 +110,14 @@ def upload(files: list[str]) -> None:
109110 pf = Path (f )
110111 if pf .is_dir ():
111112 continue
113+ size = pf .stat ().st_size
112114 click .echo (f"Uploading file { f } ..." )
115+ start = time .time ()
113116 result = client .upload_file (path = pf , file_license = config ["license" ], attribution = config ["attribution" ])
114117 metadata = result ["bma_response" ]
115- click .echo (f"File { metadata ['uuid' ]} uploaded OK!" )
118+ t = round (time .time () - start , 2 )
119+ click .echo (f"File { metadata ['uuid' ]} uploaded OK! It took { t } seconds to upload { size } bytes, speed { round (size / t )} bytes/sec" )
120+ logger .debug (f"Done, " )
116121 file_uuids .append (metadata ["uuid" ])
117122 click .echo (f"Finished uploading { len (file_uuids )} files, creating album..." )
118123 now = datetime .isoformat (datetime .now (tz = UTC ))
You can’t perform that action at this time.
0 commit comments