def setStageFailed(self, index): """given an index, sets stage to failed, adds to processed stages array""" self.stages[index].setFailed() logger.info("ERROR in Stage " + str(index) + ": " + str(self.stages[index])) self.processedStages.append(index) for i in nx.dfs_successor(self.G, index).keys(): self.processedStages.append(i)
def test_successor(self): assert_equal(nx.dfs_successor(self.G, source=0), { 0: [1], 1: [2], 2: [4], 3: [], 4: [3] })
def setStageFailed(self, index): """given an index, sets stage to failed, adds to processed stages array""" self.stages[index].setFailed() logger.info("ERROR in Stage " + str(index) + ": " + str(self.stages[index])) # This is something we should also directly report back to the user: print("\nERROR in Stage %s: %s" % (str(index), str(self.stages[index]))) print("Logfile for (potentially) more information:\n%s\n" % self.stages[index].logFile) sys.stdout.flush() self.processedStages.append(index) self.failed_stages += 1 # remove job from currently running processes self.currently_running_stage.remove(index) for i in nx.dfs_successor(self.G, index).keys(): self.processedStages.append(i)
def setStageFailed(self, index, clientURI): # given an index, sets stage to failed, adds to processed stages array # But... only if this stage has already been retried twice (<- for now static) # Once in while retrying a stage makes sense, because of some odd I/O # read write issue (NFS race condition?). At least that's what I think is # happening, so trying this to see whether it solves the issue. num_retries = self.stages[index].getNumberOfRetries() if num_retries < 2: # without a sleep statement, the stage will be retried within # a handful of milliseconds, that won't solve anything... # this sleep command will block the server for a small amount # of time, but should happen only sporadically time.sleep(STAGE_RETRY_INTERVAL) self.removeFromRunning(index, clientURI, new_status=None) self.stages[index].incrementNumberOfRetries() logger.info("RETRYING: ERROR in Stage " + str(index) + ": " + str(self.stages[index])) logger.info( "RETRYING: adding this stage back to the runnable queue.") logger.info("RETRYING: Logfile for Stage " + str(self.stages[index].logFile)) self.requeue(index) else: self.removeFromRunning(index, clientURI, new_status="failed") logger.info("ERROR in Stage " + str(index) + ": " + str(self.stages[index])) # This is something we should also directly report back to the user: print("\nERROR in Stage %s: %s" % (str(index), str(self.stages[index]))) print("Logfile for (potentially) more information:\n%s\n" % self.stages[index].logFile) sys.stdout.flush() self.processedStages.append(index) self.failed_stages += 1 for i in nx.dfs_successor(self.G, index).keys(): self.processedStages.append(i)
def test_successor(self): assert_equal(nx.dfs_successor(self.G,source=0), {0: [1], 1: [2], 2: [4], 3: [], 4: [3]})
def children(node): '''returns all childrens smaller than node.''' L = [] for i in nx.dfs_successor(G2, node).values(): L.extend(i) return L
def children(node): '''returns all childrens smaller than node.''' L = [] for i in nx.dfs_successor(G2,node).values(): L.extend(i) return L