Skip to content

Commit

Permalink
Merge pull request #11 from OpenTechStrategies/10-time-runs
Browse files Browse the repository at this point in the history
Record run time for complete upload/download operation
  • Loading branch information
nfebe authored Apr 15, 2023
2 parents c5a39d4 + 47c33d5 commit 1cd24e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test-download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
DOWNLOAD_DIR = "test-tree/downloads"

import os
import datetime


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

if __name__ == "__main__":
main()
5 changes: 4 additions & 1 deletion upload-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from utils import log, parse_cli, rclone_upload
import os
import sys
import datetime

CHALLENGING_NAMES_DIR = "test-tree/challenging-names"
APOD_DIR = "test-tree/apod"
Expand Down Expand Up @@ -41,7 +42,7 @@ def skip_p(fname, cli):
def main():
# Do some initial setup, parse cli, etc
cli = parse_cli()

start_time = datetime.datetime.now()
if os.path.abspath(cli.directory) == os.path.abspath(CHALLENGING_NAMES_DIR):
# Step through all the filenames and try to upload each one
for fname in gentree.fname_permutations():
Expand Down Expand Up @@ -69,6 +70,8 @@ def main():
rclone_upload(NESTED_DIR, cli.remote_dir, timeout=0)
else:
sys.exit("Not sure what to do with that directory.")
elapsed_time = datetime.datetime.now() - start_time
log(f"Last upload run completed in {elapsed_time}...")


if __name__ == "__main__":
Expand Down

0 comments on commit 1cd24e5

Please sign in to comment.