def idleLoop( self, interval, function ): while True: try: function( ) except Exception, e: logger.error( """Idle loop exception: %s""", traceback.format_exc( e ) ) time.sleep( interval )
def heartbeat(interval = 5): host = Utils.myHostName() while True: try: with transaction() as t: t.cur.execute("update Hydra_rendernode " "set pulse = NOW() " "where host = '%s'" % host) except Exception, e: logger.error (traceback.format_exc (e)) time.sleep(interval)
def handle( self ): logger.info ("request") try: questionBytes = self.rfile.read( ) question = pickle.loads( questionBytes ) logger.debug(question) answer = question.computeAnswer( self.TCPserver ) answerBytes = pickle.dumps( answer ) self.wfile.write( answerBytes ) except: logger.error( """Exception caught: %s""", traceback.format_exc( ) )
def __init__(self, *arglist, **kwargs): # check for another instance of RenderNodeMain.exe nInstances = len (filter (lambda line: 'RenderNodeMain' in line, subprocess.check_output ('tasklist').split('\n'))) logger.info ("%d RenderNodeMain instances running." % nInstances) if nInstances > 1: logger.info("Blocked RenderNodeMain from running because another" " instance already exists.") sys.exit(1) if nInstances == 0 and not sys.argv[0].endswith('.py'): logger.error("Can't find running RenderNodeMain.") sys.exit(1) TCPServer.__init__(self, *arglist, **kwargs) self.childProcess = None self.childKilled = False self.statusAfterDeath = None # must be a status from MySQLSetup # clean up in case we had an unexpected termination last time around [thisNode] = Hydra_rendernode.fetch ("where host = '%s'" % Utils.myHostName()) if thisNode.task_id: if thisNode.status == PENDING or thisNode.status == OFFLINE: newStatus = OFFLINE else: newStatus = IDLE unstick (taskID=thisNode.task_id, newTaskStatus=CRASHED, host=thisNode.host, newHostStatus=newStatus) # update current software version if necessary current_version = sys.argv[0] if thisNode.software_version != current_version: thisNode.software_version = current_version with transaction() as t: thisNode.update(t)
if not startDir: startDir = os.getcwd() else: startDir = currentDir mayaProjectPath = QFileDialog.getOpenFileName( parent=self, caption="Find workspace.mel", directory=startDir, filter="workspace.mel") if mayaProjectPath: # remove "workspace.mel" from the end of the path mayaProjectPath = str(mayaProjectPath).split('/') mayaProjectPath.pop() mayaProjectPath = '/'.join(mayaProjectPath) + '/' self.projectDirLineEdit.setText(mayaProjectPath) if __name__ == '__main__': try: logger.debug(sys.argv) # prints out argv app = QApplication( sys.argv ) window = SubmitterWindow( ) window.show( ) retcode = app.exec_( ) sys.exit( retcode ) except Exception, e: logger.error( traceback.format_exc( e ) ) raise