-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtester.py
executable file
·78 lines (48 loc) · 1.93 KB
/
tester.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/python2
"""
This file is part of multissh.
multissh is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
multissh is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with multissh. If not, see <http://www.gnu.org/licenses/>.
"""
"""
This file was used to run experiments
Examples: baseline rsync vs our version
baseline ssh with ls vs ours
"""
import sys
import time
import subprocess
import shlex
RUNS = int(sys.argv[1])
baseline_rsync_command = "rsync -a blaine1@"+sys.argv[2]+":"+sys.argv[3]+" "+sys.argv[3]
baseline_rsync_filename = "rsync_baseline.out"
rsync_3_workers_command = 'rsync -a --rsh="/home/blaine1/multissh/multissh.py" blaine1@'+sys.argv[2]+":"+sys.argv[3]+" "+sys.argv[3]
rsync_3_workers_filename = "rsync_3_workers.out"
print(rsync_3_workers_command)
ls_ssh_command = "ssh -l blaine1 cold06 ls"
ls_ssh_filename = "ssh_ls.out"
ls_3_workers_command = "./multissh.py -l blaine1 cold06 ls"
ls_3_workers_filename = "3_workers_ls.out"
def test_command(file_name, command):
results = open(file_name, "a")
args = shlex.split(command)
cleanup = "rm -f " + sys.argv[3]
cleanup_args = shlex.split(cleanup)
for i in range(RUNS):
start = time.time()
subprocess.call(args)
end = time.time()
results.write(str(end-start) + "\n")
subprocess.call(cleanup_args)
#test_command(baseline_rsync_filename, baseline_rsync_command)
test_command(rsync_3_workers_filename, rsync_3_workers_command)
#test_command(ls_ssh_filename, ls_ssh_command)
#test_command(ls_3_workers_filename, ls_3_workers_command)