def onlineThisNodeHandler(self): """Changes the local render node's status to online if it was offline, goes back to started if it was pending offline.""" thisNode = NodeUtils.getThisNodeOBJ() if thisNode: thisNode.online() self.updateStatusBar(thisNode) self.populateNodeTree()
def offlineThisNodeHandler(self): """Changes the local render node's status to offline if it was idle, pending if it was working on something.""" #Get the most current info from the database thisNode = NodeUtils.getThisNodeOBJ() if thisNode: thisNode.offline() self.updateStatusBar(thisNode) self.populateNodeTree()
def findThisNode(self): """Makes sure this node exists in the hydra_rendernode board. Alerts the user if not.""" thisNode = NodeUtils.getThisNodeOBJ() if thisNode: return thisNode else: warningBox(self, title="Notice", msg=Constants.DOESNOTEXISTERR_STRING) self.setThisNodeButtonsEnabled(False) return None
def getOffThisNodeHandler(self): """Offlines the node and sends a message to the render node server running on localhost to kill its current task(task will be resubmitted)""" thisNode = NodeUtils.getThisNodeOBJ() if not thisNode: return choice = yesNoBox(self, "Confirm", Constants.GETOFFLOCAL_STRING) if choice == QMessageBox.Yes: response = thisNode.getOff() if not response: logger.error("Could not GetOff this node!") warningBox(self, "GetOff Error", "Could not GetOff this node!") self.populateNodeTree() self.updateStatusBar(thisNode)
def __init__(self): QMainWindow.__init__(self) self.setupUi(self) with open(Utils.findResource("styleSheet.css"), "r") as myStyles: self.setStyleSheet(myStyles.read()) self.thisNode = NodeUtils.getThisNodeOBJ() self.isVisable = True self.pulseThreadStatus = False self.renderServerStatus = False self.schedThreadStatus = False self.autoUpdateStatus = False if not self.thisNode: self.offlineButton.setEnabled(False) self.getoffButton.setEnabled(False) logger.error("Node does not exist in database!") aboutBox(self, "Error", "This node was not found in the database! If you wish to render " "on this node it must be registered with the databse. Run " "Register.exe or Register.py to regiester this node and " " try again.") sys.exit(1) self.currentSchedule = self.thisNode.weekSchedule self.currentScheduleEnabled = self.thisNode.scheduleEnabled self.buildUI() self.connectButtons() self.updateThisNodeInfo() self.startupServers() logger.info("Render Node Main is live! Waiting for tasks...") try: autoHide = True if str(sys.argv[1]).lower() == "true" else False logger.info(autoHide) except IndexError: autoHide = False if autoHide and self.trayIconBool: logger.info("Autohide is enabled!") self.sendToTrayHandler() else: self.show()
def schedulerMain(self): if not self.thisNode: self.scheduleThreadPixmap.setPixmap(self.needsAttentionPixmap) logger.error("Node OBJ not found by schedulerMain! Checking again in 24 hours.") #Sleep for 24 hours return 86400 self.updateThisNodeInfo() sleepTime, nowStatus = NodeUtils.calcuateSleepTimeFromNode(self.thisNode.host) if not sleepTime or not nowStatus: logger.error("Could not find schdule! Checking again in 24 hours.") return 86400 if nowStatus == READY: self.startupEvent() else: self.shutdownEvent() #Add an extra minute just in case return sleepTime + 60