Skip to content

Commit 47c33d5

Browse files
committed
Record run time for complete upload/download operation
Currently there's timing that measures how much time each file takes to upload or download. With this commit, we can get the run time for a complete upload or download run (that is time taken to upload mutilple files and folders). Signed-off-by: Fon E. Noel NFEBE <[email protected]>
1 parent c5a39d4 commit 47c33d5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

test-download.py

+5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55
DOWNLOAD_DIR = "test-tree/downloads"
66

77
import os
8+
import datetime
9+
810

911
def main():
1012
# Do some initial setup, parse cli, etc
1113
cli = parse_cli()
14+
start_time = datetime.datetime.now()
1215
rclone_download(os.path.join(DOWNLOAD_DIR, cli.remote_dir), cli.remote_dir)
16+
elapsed_time = datetime.datetime.now() - start_time
17+
log(f"Last download run completed in {elapsed_time}...")
1318

1419
if __name__ == "__main__":
1520
main()

upload-test.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from utils import log, parse_cli, rclone_upload
44
import os
55
import sys
6+
import datetime
67

78
CHALLENGING_NAMES_DIR = "test-tree/challenging-names"
89
APOD_DIR = "test-tree/apod"
@@ -41,7 +42,7 @@ def skip_p(fname, cli):
4142
def main():
4243
# Do some initial setup, parse cli, etc
4344
cli = parse_cli()
44-
45+
start_time = datetime.datetime.now()
4546
if os.path.abspath(cli.directory) == os.path.abspath(CHALLENGING_NAMES_DIR):
4647
# Step through all the filenames and try to upload each one
4748
for fname in gentree.fname_permutations():
@@ -69,6 +70,8 @@ def main():
6970
rclone_upload(NESTED_DIR, cli.remote_dir, timeout=0)
7071
else:
7172
sys.exit("Not sure what to do with that directory.")
73+
elapsed_time = datetime.datetime.now() - start_time
74+
log(f"Last upload run completed in {elapsed_time}...")
7275

7376

7477
if __name__ == "__main__":

0 commit comments

Comments
 (0)