当前位置: 首页>>代码示例>>Python>>正文


Python Configuration.getMyID方法代码示例

本文整理汇总了Python中configure.Configuration.getMyID方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.getMyID方法的具体用法?Python Configuration.getMyID怎么用?Python Configuration.getMyID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configure.Configuration的用法示例。


在下文中一共展示了Configuration.getMyID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: lineReceived

# 需要导入模块: from configure import Configuration [as 别名]
# 或者: from configure.Configuration import getMyID [as 别名]
 def lineReceived(self, line):
     stdout.write("Server%d Received Data: %s\n" %( Configuration.getMyID(), line))
     delMsgs = self.algorithm.receiveMsg(line, self.node)
     #return the jsonmsg to various nodes 
     #send jsonmsg to nodes to notify them 
     #it's for conflicts
     #self.send2Node(0, "fake conflict notification")
     if delMsgs:
         for delMsg in delMsgs: 
             #put delete event into the log and execute delete
             e = self.node.createEvent(delMsg)
         for i in range(self.algorithm.n):#@TODO this line is broadcast  
             jsonmsg = self.algorithm.sendMsg2Node(i) 
             self.send2Node(i, jsonmsg)
开发者ID:xil12008,项目名称:calendar-wuu-bernstein-algorithm,代码行数:16,代码来源:calendarserver.py

示例2: sendMsg2Node

# 需要导入模块: from configure import Configuration [as 别名]
# 或者: from configure.Configuration import getMyID [as 别名]
 def sendMsg2Node(self, nodek):
     #@TODO load log from database
     log = self.dc.getLogs(0,sys.maxint)
     NP = {} #partial log
     ES = {} #event lists
     matrix =  [[0 for _ in range(self.n) ] for _ in range(self.n)]
     for i in range(self.n):
         for j in range(self.n):
             matrix[i][j] = self.dc.getTime(i, j)
     for (id,name,time,content) in log:
         event = Event(id,name,time,content)
         if not self.__hasRec(matrix, event, nodek):
            ES[event.name] = (event.time, event.node, event.content)  
            logging.debug((event.time, event.node, event.content))
     NP["matrix"] = matrix
     NP["events"] = ES 
     NP["senderID"] = Configuration.getMyID() 
     NP["receiverID"] = nodek 
     logging.debug(json.dumps(NP))
     return json.dumps(NP)
开发者ID:xil12008,项目名称:calendar-wuu-bernstein-algorithm,代码行数:22,代码来源:wbalgorithm.py

示例3: __init__

# 需要导入模块: from configure import Configuration [as 别名]
# 或者: from configure.Configuration import getMyID [as 别名]
 def __init__(self):
     self.n = Configuration.getN()
     self.C = 0
     self.ID = Configuration.getMyID()
     self.dc = DataConn()
开发者ID:xil12008,项目名称:calendar-wuu-bernstein-algorithm,代码行数:7,代码来源:wbalgorithm.py

示例4: send2Node

# 需要导入模块: from configure import Configuration [as 别名]
# 或者: from configure.Configuration import getMyID [as 别名]
 def send2Node(self, nodeId, data):
     for name, protocol in self.users.iteritems():
         if name == nodeId and nodeId != Configuration.getMyID(): 
             protocol.sendLine(data)
             return
     logging.warning("One server's message not reply to client because no connection found or it's itself.")
开发者ID:xil12008,项目名称:calendar-wuu-bernstein-algorithm,代码行数:8,代码来源:calendarserver.py


注:本文中的configure.Configuration.getMyID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。