-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexperiment5.py
More file actions
36 lines (32 loc) · 939 Bytes
/
Copy pathexperiment5.py
File metadata and controls
36 lines (32 loc) · 939 Bytes
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
import subprocess
import time
path = './5nodes/trans0.txt'
with open(path, 'r') as file:
data = file.readlines()
count = 0
t = time.time()
for line in data:
attributes = line.replace('\n', '').split(' ')
# print(attributes)
id = attributes[0][2]
if id == '1':
ip_port = '192.168.0.5:5000'
elif id == '2':
ip_port = '192.168.0.1:5000'
elif id == '3':
ip_port = '192.168.0.2:5000'
elif id == '4':
ip_port = '192.168.0.3:5000'
full_command = 'python cli.py t ' + ip_port + ' ' + attributes[1]
print(full_command)
# full_command = 'ls'
process = subprocess.Popen(full_command.split(), stdout=subprocess.PIPE)
print(ip_port)
count = count+1
t1 = time.time()
timetotal = t1-t
throughput = count/(timetotal/1000)
print(throughput)
# command = 'cli.py t '+ attributes[0] + ' ' + attributes[1]
# process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
# output, error = process.communicate()