def getOffThisNodeButtonClicked(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 = None try: thisNode = getThisNodeData() except sqlerror as err: logger.debug(str(err)) self.sqlErrorBox() return choice = yesNoBox(self, "Confirm", "All progress on the current job" " will be lost. Are you sure you want to stop it?") if choice != QMessageBox.Yes: aboutBox(self, "Abort", "No action taken.") return if thisNode: offlineNode(thisNode) if thisNode.task_id: try: # TODO: use JobKill for getOff instead of doing it manually killed = sendKillQuestion(renderhost = "localhost", newStatus = READY) if not killed: logger.debug("There was a problem killing the task.") aboutBox(self, "Error", "There was a problem killing" " the task.") else: aboutBox(self, "Success", "Job was successfully" " stopped. Node offlined.") except socketerror: logger.debug(socketerror.message) aboutBox(self, "Error", "There was a problem communicating" " with the render node software. Either it's not" " running, or it has become unresponsive.") else: aboutBox(self, "Offline", "No job was running. Node offlined.") self.doFetch()
def getOffRenderNodesButtonClicked(self): """For all nodes with boxes checked in the render nodes table, changes status to offline if idle, or pending if started, and attempts to kill any task that is running on each node.""" hosts = getCheckedItems(table=self.renderNodeTable, itemColumn=1, checkBoxColumn=0) if len(hosts) == 0: self.noneCheckedBox() return choice = yesNoBox(self, "Confirm", "<B>WARNING</B>: All progress on" " current tasks will be lost for the selected" " render nodes. Are you sure you want to stop these" " nodes? <br>" + str(hosts)) if choice != QMessageBox.Yes: aboutBox(self, "Aborted", "No action taken.") return error = False notKilledList = list() with transaction() as t: rendernode_rows = Hydra_rendernode.fetch(explicitTransaction=t) for node_row in rendernode_rows: if node_row.host in hosts: offlineNode(node_row) try: killed = sendKillQuestion(node_row.host, READY) error = error or not killed except socketerror as err: logger.debug(str(err) + '\n' + "Error while trying to contact " + node_row.host) notKilledList.append(node_row.host) error = True if error: aboutBox(self, "Error", "The following nodes could not be stopped" " for some reason. Look in FarmView.log for more details." "<br>" + str(notKilledList)) self.doFetch()