-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget.py
More file actions
executable file
·30 lines (21 loc) · 1.1 KB
/
get.py
File metadata and controls
executable file
·30 lines (21 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python3
import argparse
import subprocess
def main():
parser = argparse.ArgumentParser("Download an experiment directory")
parser.add_argument("timestamp", type=str, help="Timestamp of experiment")
parser.add_argument("-r", "--root", type=str, default="/h/jkelly/kfac-pytorch/experiments/",
help="Remote root directory")
parser.add_argument("-s", "--ssh", type=str, default="vd", help="SSH host")
parser.add_argument("-e", "--exclude", type=str, nargs="+", default=["*.pickle", "*.pt"],
help="Exclude files matching these regex(s)")
args = parser.parse_args()
# -a: recurse into subdirectories, turn on archive mode and all other options
# -v: verbose
# -e: use ssh for encryption
# --exclude: exclude all checkpoint files (large and unnecessary)
exclude_str = " ".join([f"--exclude='{exclude}'" for exclude in args.exclude])
cmd = f"rsync -av -e ssh {exclude_str} {args.ssh}:{args.root}/{args.timestamp}/ {args.timestamp}/"
subprocess.run(cmd, shell=True, check=True)
if __name__ == "__main__":
main()