Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record run time for complete upload/download operation #11

Merged
merged 1 commit into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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