Skip to content

Commit

Permalink
fixing a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wisaaco committed Jul 29, 2019
1 parent 231dead commit 50a46d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions src/examples/DynamicFailuresOnNodes/selection_multipleDeploys.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def __init__(self):
self.rr = {} # for a each type of service, we have a mod-counter
self.messages_affected = []


def get_path(self, sim, app_name, message, topology_src, alloc_DES, alloc_module, traffic, from_des):

node_src = topology_src
Expand Down Expand Up @@ -107,13 +108,16 @@ def get_path(self, sim, app_name, message, topology_src, alloc_DES, alloc_module

return [path],[des]


def get_path_from_failure(self, sim, message, link, alloc_DES, alloc_module, traffic, ctime, from_des):
# print "Example of enrouting"
# print message.path # [86, 242, 160, 164, 130, 301, 281, 216]
# print message.dst_int # 301
# print link #(130, 301) link is broken! 301 is unreacheble

idx = message.path.index(link[0])
# print "idx: ", idx

if idx == len(message.path):
# The node who serves ... not possible case
return [],[]
Expand All @@ -125,15 +129,21 @@ def get_path_from_failure(self, sim, message, link, alloc_DES, alloc_module, tra
#print "DST: ",node_dst #261
#print "INT: ",message.dst_int #301

path, des = self.get_path(sim,message.app_name,message,node_src,alloc_DES,alloc_module,traffic,from_des)
if len(path[0]) > 0:
#print path # [[164, 130, 380, 110, 216]]
#print des # [40]

path, des = self.get_path(sim, message.app_name, message, node_src, alloc_DES, alloc_module, traffic,
from_des)




if len(path[0]) > 1:
# print "PAHT ",path # [[164, 130, 380, 110, 216]]
# print "DES ",des # [40]

concPath = message.path[0:message.path.index(path[0][0])] + path[0]
# print concPath # [86, 242, 160, 164, 130, 380, 110, 216]
# print "CPATH ",concPath # [86, 242, 160, 164, 130, 380, 110, 216]
newINT = path[0][2]
# print newINT # 380
# print "NI ",newINT # 380

message.dst_int = newINT
return [concPath], des
Expand Down
2 changes: 1 addition & 1 deletion src/yafs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def __network_process(self):
#This fact is produced when a node or edge the topology is changed or disappeared
self.logger.warning("The initial path assigned is unreachabled. Link: (%i,%i). Routing a new one. %i"%(link[0],link[1],self.env.now))

paths, DES_dst = self.selector_path[message.app_name].get_path_from_failure(self, message, link, self.alloc_DES,self.alloc_module, self.last_busy_time,self.env.now)
paths, DES_dst = self.selector_path[message.app_name].get_path_from_failure(self, message, link, self.alloc_DES,self.alloc_module, self.last_busy_time,self.env.now,from_des=message.idDES)

if DES_dst == [] and paths==[]:
#Message communication ending:
Expand Down

0 comments on commit 50a46d7

Please sign in to comment.