#NEWLINE# def _send_presence( self , msg ) : #NEWLINE# #INDENT# '\n        Forward an presence message to all subscribed yards\n        Presence message has a route\n        ' #NEWLINE# y_name = msg [ 'route' ] [ 'src' ] [ 1 ] #NEWLINE# if ( y_name not in self . lane_stack . value . nameRemotes ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( 'data' in msg ) and ( 'state' in msg [ 'data' ] ) ) : #NEWLINE# #INDENT# state = msg [ 'data' ] [ 'state' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# state = None #NEWLINE# #UNINDENT# if ( state in [ None , 'available' , 'present' ] ) : #NEWLINE# #INDENT# present = odict ( ) #NEWLINE# for name in self . availables . value : #NEWLINE# #INDENT# minion = self . aliveds . value . get ( name , None ) #NEWLINE# present [ states ] = ( minion . ha [ 0 ] if minion else None ) #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# 'present' : present , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# states = { #NEWLINE# #INDENT# 'joined' : self . alloweds , #NEWLINE# 'allowed' : self . alloweds , #NEWLINE# 'alived' : self . aliveds , #NEWLINE# 'reaped' : self . reapeds , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# minions = states [ state ] . value #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# log . error ( 'Lane Router Received invalid message: {0}' . format ( msg ) ) #NEWLINE# return #NEWLINE# #UNINDENT# result = odict ( ) #NEWLINE# for name in minions : #NEWLINE# #INDENT# result [ name ] = minions [ name ] . ha [ 0 ] #NEWLINE# #UNINDENT# data = { #NEWLINE# #INDENT# state : result , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# tag = tagify ( 'present' , 'presence' ) #NEWLINE# route = { #NEWLINE# #INDENT# 'dst' : ( None , None , 'event_fire' ) , #NEWLINE# 'src' : ( None , self . lane_stack . value . local . name , None ) , #NEWLINE# #UNINDENT# } #NEWLINE# msg = { #NEWLINE# #INDENT# 'route' : route , #NEWLINE# 'tag' : tag , #NEWLINE# 'data' : data , #NEWLINE# #UNINDENT# } #NEWLINE# self . lane_stack . value . transmit ( msg , self . lane_stack . value . fetchUidByName ( y_name ) ) #NEWLINE# self . lane_stack . value . serviceAll ( )