forked from aws/aws-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark-mv
executable file
·43 lines (36 loc) · 1.4 KB
/
benchmark-mv
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
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
from benchmark_utils import backup, copy, clean, get_default_argparser
from benchmark_utils import create_random_subfolder, benchmark_command
from benchmark_utils import get_transfer_command
def benchmark_mv(args):
destination = args.destination
if args.recursive:
destination = create_random_subfolder(destination)
command = 'mv %s %s' % (args.source, destination)
command = get_transfer_command(command, args.recursive, args.quiet)
backup_path = backup(args.source, args.recursive)
def cleanup():
if not args.no_cleanup:
clean(destination, args.recursive)
clean(backup_path, args.recursive)
def upkeep():
clean(args.source, args.recursive)
copy(backup_path, args.source, args.recursive)
benchmark_command(
command, args.benchmark_script, args.summarize_script,
args.result_dir, args.num_iterations, args.dry_run,
upkeep=upkeep,
cleanup=cleanup
)
if __name__ == "__main__":
parser = get_default_argparser()
parser.add_argument(
'-s', '--source', required=True,
help='A local path or s3 path.'
)
parser.add_argument(
'-d', '--destination', required=True,
help='A local path or s3 path. A directory will be created in this '
'location to move to in the case of a recursive transfer.'
)
benchmark_mv(parser.parse_args())