Skip to content

Commit

Permalink
final update
Browse files Browse the repository at this point in the history
  • Loading branch information
sbshrey committed Nov 3, 2018
1 parent c602c7a commit cc5c802
Show file tree
Hide file tree
Showing 11 changed files with 252 additions and 154 deletions.
4 changes: 2 additions & 2 deletions apps/cpu_dynamic/new_cpu_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def action_ci(devices,devices_data):
end = time.time()
cpu_dynamism.write("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}\n".format(d,d_type,start,end,coremark_max,coremark_min,prev_coremark,coremark,"no",r,probability))

with open('../../dump/resource_dynamism/cpu_dynamism/device_cpus_updated_{0}.json'.format(d_type),'w') as file:
file.write(json.dumps(device_cpus_updated))
#with open('../../dump/resource_dynamism/cpu_dynamism/device_cpus_updated_{0}.json'.format(d_type),'w') as file:
# file.write(json.dumps(device_cpus_updated))

infra_config = json.load(open("../../config/infra_config.json"))
vm_config = json.load(open("../../config/vm_config.json"))
Expand Down
50 changes: 28 additions & 22 deletions apps/mttf/new_mttf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
coremark_exe = "violet/coremark_exe"
device_down_set = set()


'''
def read_cm(device):
vm_name = deployment_output[device]["host_vm_name"]
host = container_vm[vm_name]["hostname_ip"]
Expand Down Expand Up @@ -71,6 +71,9 @@ def read_cm(device):
f.close()
c.close()
'''


def device_down(devices,devices_data,devices_down):
print
print "Active Devices - {}".format(len(devices))
Expand All @@ -95,13 +98,13 @@ def device_down(devices,devices_data,devices_down):
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(hostname = host, username = user, pkey = k)

read_cm(d)
print
#read_cm(d)
#print
command="sudo docker stop {}".format(d)

start = time.time()
stdin, stdout, stderr = c.exec_command(command,timeout=60)
print stderr.read()
#print stderr.read()
end = time.time()
mttf_dynamism.write("{0},{1},{2},{3},{4},{5},{6}\n".format(d,d_type,start,end,"inactive",r,mttf_prob))
c.close()
Expand Down Expand Up @@ -131,25 +134,26 @@ def device_down(devices,devices_data,devices_down):
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(hostname = host, username = user, pkey = k)

'''
device_type = infra_config["devices"][d]["device_type"]
if (device_type == "SI"):
path = "{0}/si/coremark.exe".format(coremark_exe)
else:
path = "{0}/pi/coremark.exe".format(coremark_exe)
command = "sudo docker start {}".format(d)
'''
command = "sudo docker start {}".format(d)
start = time.time()
stdin, stdout, stderr = c.exec_command(command,timeout=60)
print stderr.read()
#print stderr.read()
end = time.time()
# starting coremark again for remaining time
cm_run_time = abs(int(end_time - end))
command = "sudo docker exec -d {0} python {1}/c_coremark.py {2} {3}".format(d,coremark_exe,path,cm_run_time)
print("starting coremark\n{}".format(command))
stdin, stdout, stderr = c.exec_command(command,timeout=60)
print stderr.read()
#cm_run_time = abs(int(end_time - end))
#command = "sudo docker exec -d {0} python {1}/c_coremark.py {2} {3}".format(d,coremark_exe,path,cm_run_time)
#print("starting coremark\n{}".format(command))
#stdin, stdout, stderr = c.exec_command(command,timeout=60)
#print stderr.read()
c.close()
mttf_dynamism.write("{0},{1},{2},{3},{4},{5},{6}\n".format(d,d_type,start,end,"active",r,mttr_prob))
devices.append(d)
Expand Down Expand Up @@ -215,7 +219,7 @@ def device_down(devices,devices_data,devices_down):
#f = open("../../dump/resource_dynamism/mttf/device_cm/{}".format(d),"w")
#f.write("Coremark\n")
#f.close()

'''
for d in devices:
vm_name = deployment_output[d]["host_vm_name"]
host = container_vm[vm_name]["hostname_ip"]
Expand All @@ -238,17 +242,17 @@ def device_down(devices,devices_data,devices_down):
stdin, stdout, stderr = c.exec_command(command,timeout=60)
print command,stderr.read()
c.close()

'''

#os.system("mkdir -p ../../dump/resource_dynamism/mttf_mttr/device_cm")

mttf_dynamism = open("../../dump/resource_dynamism/mttf/mttf_dynamism_raw.txt","w")
#mttr_dynamism = open("../../dump/resource_dynamism/mttf_mttr/mttr_dynamism_raw.txt","w")

print
print "waiting for coremark to execute for atleast once (60 seconds)"
print
time.sleep(60)
#print
#print "waiting for coremark to execute for atleast once (60 seconds)"
#print
#time.sleep(60)

end_time = time.time() + int(dynamism_duration)
#print "End time - {0}".format(end_time)
Expand Down Expand Up @@ -287,6 +291,7 @@ def device_down(devices,devices_data,devices_down):
c.connect(hostname = host, username = user, pkey = k)

command = "sudo docker start {}".format(d)
'''
print command
#start = time.time()
stdin, stdout, stderr = c.exec_command(command,timeout=60)
Expand All @@ -303,15 +308,16 @@ def device_down(devices,devices_data,devices_down):
command = "sudo docker exec -d {0} python {1}/c_coremark.py {2} {3}".format(d,coremark_exe,path,cm_run_time)
stdin, stdout, stderr = c.exec_command(command,timeout=60)
print command,stderr.read()
'''
c.close()

print
print "waiting for coremark to finish (60 seconds)"
#print "waiting for coremark to finish (60 seconds)"
print
time.sleep(60)
#time.sleep(60)

devices = infra_config["devices"].keys()

'''
for device in devices:
read_cm(device)

'''
4 changes: 2 additions & 2 deletions apps/pub_sub/scripts/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ def main(argv):
if argv[2]=="private":
filename = "/etc/mosquitto/mosquitto-private.conf"
f = open(filename,"w")
data = "bind_address " + argv[1]
data = "bind_address " + argv[1] + "\nmax_inflight_messages 1"
f.write(data)
f.close()
else:
filename = "/etc/mosquitto/mosquitto-public.conf"
f = open(filename,"w")
data = "bind_address " + argv[1]
data = "bind_address " + argv[1] +"\nmax_inflight_messages 1"
f.write(data)
f.close()

Expand Down
2 changes: 1 addition & 1 deletion apps/pub_sub/scripts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import os

INTERVAL = 1
INTERVAL = 2
QOS = 0

topic1="pub_"
Expand Down
150 changes: 75 additions & 75 deletions config/D1000_vm_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,153 +7,153 @@
}
},
"container_VM": {
"AEP-1": {
"hostname_ip": "10.0.0.9",
"key_path": "/home/centos/aep_rsa",
"VM1": {
"hostname_ip": "10.0.0.34",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-2": {
"hostname_ip": "10.0.0.10",
"key_path": "/home/centos/aep_rsa",
"VM2": {
"hostname_ip": "10.0.0.35",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-3": {
"hostname_ip": "10.0.0.11",
"key_path": "/home/centos/aep_rsa",
"VM3": {
"hostname_ip": "10.0.0.36",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-4": {
"hostname_ip": "10.0.0.12",
"key_path": "/home/centos/aep_rsa",
"VM4": {
"hostname_ip": "10.0.0.37",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-5": {
"hostname_ip": "10.0.0.13",
"key_path": "/home/centos/aep_rsa",
"VM5": {
"hostname_ip": "10.0.0.38",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-6": {
"hostname_ip": "10.0.0.14",
"key_path": "/home/centos/aep_rsa",
"VM6": {
"hostname_ip": "10.0.0.39",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-7": {
"hostname_ip": "10.0.0.15",
"key_path": "/home/centos/aep_rsa",
"VM7": {
"hostname_ip": "10.0.0.40",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-8": {
"hostname_ip": "10.0.0.16",
"key_path": "/home/centos/aep_rsa",
"VM8": {
"hostname_ip": "10.0.0.41",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-9": {
"hostname_ip": "10.0.0.17",
"key_path": "/home/centos/aep_rsa",
"VM9": {
"hostname_ip": "10.0.0.42",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-10": {
"hostname_ip": "10.0.0.18",
"key_path": "/home/centos/aep_rsa",
"VM10": {
"hostname_ip": "10.0.0.43",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-11": {
"hostname_ip": "10.0.0.19",
"key_path": "/home/centos/aep_rsa",
"VM11": {
"hostname_ip": "10.0.0.44",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-12": {
"hostname_ip": "10.0.0.20",
"key_path": "/home/centos/aep_rsa",
"VM12": {
"hostname_ip": "10.0.0.45",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-13": {
"hostname_ip": "10.0.0.21",
"key_path": "/home/centos/aep_rsa",
"VM13": {
"hostname_ip": "10.0.0.46",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-14": {
"hostname_ip": "10.0.0.22",
"key_path": "/home/centos/aep_rsa",
"VM14": {
"hostname_ip": "10.0.0.47",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-15": {
"hostname_ip": "10.0.0.23",
"key_path": "/home/centos/aep_rsa",
"VM15": {
"hostname_ip": "10.0.0.48",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-16": {
"hostname_ip": "10.0.0.24",
"key_path": "/home/centos/aep_rsa",
"VM16": {
"hostname_ip": "10.0.0.49",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-17": {
"hostname_ip": "10.0.0.25",
"key_path": "/home/centos/aep_rsa",
"VM17": {
"hostname_ip": "10.0.0.50",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-18": {
"hostname_ip": "10.0.0.26",
"key_path": "/home/centos/aep_rsa",
"VM18": {
"hostname_ip": "10.0.0.51",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-19": {
"hostname_ip": "10.0.0.27",
"key_path": "/home/centos/aep_rsa",
"VM19": {
"hostname_ip": "10.0.0.52",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-20": {
"hostname_ip": "10.0.0.28",
"key_path": "/home/centos/aep_rsa",
"VM20": {
"hostname_ip": "10.0.0.53",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-21": {
"hostname_ip": "10.0.0.29",
"key_path": "/home/centos/aep_rsa",
"VM21": {
"hostname_ip": "10.0.0.54",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-22": {
"hostname_ip": "10.0.0.30",
"key_path": "/home/centos/aep_rsa",
"VM22": {
"hostname_ip": "10.0.0.55",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-23": {
"hostname_ip": "10.0.0.31",
"key_path": "/home/centos/aep_rsa",
"VM23": {
"hostname_ip": "10.0.0.56",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-24": {
"hostname_ip": "10.0.0.32",
"key_path": "/home/centos/aep_rsa",
"VM24": {
"hostname_ip": "10.0.0.57",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
},
"AEP-25": {
"hostname_ip": "10.0.0.33",
"key_path": "/home/centos/aep_rsa",
"VM25": {
"hostname_ip": "10.0.0.58",
"key_path": "/home/centos/id_rsa",
"user": "centos",
"vm_type": "Standard_D64_v3"
}
Expand Down
2 changes: 1 addition & 1 deletion config/infra_config.json

Large diffs are not rendered by default.

Loading

0 comments on commit cc5c802

Please sign in to comment.