def processInput(self, netString): startTime = time.time() try : assert not self.jobInProgress self.jobInProgress = True self.statsList = [] log.info("Starting processing of new input.") except : log.warn("Another graph processing in progress. Retry later.") return -1 self.graph = graph.stringToGraph(netString) self.sendNetworkPrime() self.sendGraphToSlaves() self.sendServerListToSlaves() self.sendInitialTaskToSlaves() self.sendProcessStartNotification() self.totalTaskCount = 0 while self.jobCompletedSlaveCount < self.m : # wait for processing to get over time.sleep(JOB_NOT_FINISHED_WAIT_TIME) endTime = time.time() logMsg = "Total (" + str(self.totalTaskCount) + ") jobs completed in " \ + str(endTime-startTime) + "s." log.info(logMsg) printStats(self.statsList, logMsg) self.jobCompletedSlaveCount = 0 self.jobInProgress = False
def processInput(self, netString): startTime = time.time() try: assert not self.jobInProgress self.jobInProgress = True self.statsList = [] log.info("Starting processing of new input.") except: log.warn("Another graph processing in progress. Retry later.") return -1 self.graph = graph.stringToGraph(netString) self.sendNetworkPrime() self.sendGraphToSlaves() self.sendServerListToSlaves() self.sendInitialTaskToSlaves() self.sendProcessStartNotification() self.totalTaskCount = 0 while self.jobCompletedSlaveCount < self.m: # wait for processing to get over time.sleep(JOB_NOT_FINISHED_WAIT_TIME) endTime = time.time() logMsg = "Total (" + str(self.totalTaskCount) + ") jobs completed in " \ + str(endTime-startTime) + "s." log.info(logMsg) printStats(self.statsList, logMsg) self.jobCompletedSlaveCount = 0 self.jobInProgress = False
from src.graph.graph import Graph from src.graph.graph import stringToGraph assert stringToGraph("3$011101110").toString()\ == Graph(3,3,[(0,1),(1,2),(0,2)]).toString()
def saveGraph(self, netString): self.initGraph = graph.stringToGraph(netString) log.info("Graph saved")