Skip to content

Commit 202c7b8

Browse files
committed
time 'bma upload' runs
1 parent 6ee7de2 commit 202c7b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bma_cli/bma_cli.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The BMA CLI wrapper."""
2+
import time
23

34
import json
45
import 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))

0 commit comments

Comments
 (0)