def stop_task(self): task_id = self.currentrow[0] status = self.currentrow[5] if status in ('RUNNING', 'CONTINUING', 'ABOUT TO SLEEP', 'SLEEPING'): if status == 'SLEEPING': bibsched_set_status(task_id, 'NOW STOP', 'SLEEPING') bibsched_send_signal(task_id, signal.SIGCONT) count = 10 while bibsched_get_status(task_id) == 'NOW STOP': if count <= 0: bibsched_set_status(task_id, 'ERROR', 'NOW STOP') self.update_rows() self.repaint() self.display_in_footer( "It seems impossible to wakeup this task.") return time.sleep(CFG_BIBSCHED_REFRESHTIME) count -= 1 else: bibsched_set_status(task_id, 'ABOUT TO STOP', status) self.update_rows() self.repaint() self.display_in_footer("STOP signal sent to task #%s" % task_id) else: self.display_in_footer("Cannot stop non-running processes")
def kill_task(self): task_id = self.currentrow[0] process = self.currentrow[1] status = self.currentrow[5] if status in ('RUNNING', 'CONTINUING', 'ABOUT TO STOP', 'ABOUT TO SLEEP', 'SLEEPING'): if self._display_YN_box("Are you sure you want to kill the %s process %s?" % (process, task_id)): bibsched_send_signal(task_id, signal.SIGKILL) bibsched_set_status(task_id, 'KILLED') self.update_rows() self.repaint() self.display_in_footer("KILL signal sent to task #%s" % task_id) else: self.display_in_footer("Cannot kill non-running processes")
def kill_task(self): task_id = self.currentrow[0] process = self.currentrow[1] status = self.currentrow[5] if status in ('RUNNING', 'CONTINUING', 'ABOUT TO STOP', 'ABOUT TO SLEEP', 'SLEEPING'): if self._display_YN_box( "Are you sure you want to kill the %s process %s?" % (process, task_id)): bibsched_send_signal(task_id, signal.SIGKILL) bibsched_set_status(task_id, 'KILLED') self.update_rows() self.repaint() self.display_in_footer("KILL signal sent to task #%s" % task_id) else: self.display_in_footer("Cannot kill non-running processes")
def stop_task(self): task_id = self.currentrow[0] status = self.currentrow[5] if status in ('RUNNING', 'CONTINUING', 'ABOUT TO SLEEP', 'SLEEPING'): if status == 'SLEEPING': bibsched_set_status(task_id, 'NOW STOP', 'SLEEPING') bibsched_send_signal(task_id, signal.SIGCONT) count = 10 while bibsched_get_status(task_id) == 'NOW STOP': if count <= 0: bibsched_set_status(task_id, 'ERROR', 'NOW STOP') self.update_rows() self.repaint() self.display_in_footer("It seems impossible to wakeup this task.") return time.sleep(CFG_BIBSCHED_REFRESHTIME) count -= 1 else: bibsched_set_status(task_id, 'ABOUT TO STOP', status) self.update_rows() self.repaint() self.display_in_footer("STOP signal sent to task #%s" % task_id) else: self.display_in_footer("Cannot stop non-running processes")
def wakeup_task(self): if not self.currentrow: self.display_in_footer("no task selected") return task_id = self.currentrow[0] status = self.currentrow[5] #if self.count_processes('RUNNING') + self.count_processes('CONTINUING') >= 1: #self.display_in_footer("a process is already running!") if status == "SLEEPING": if not bibsched_send_signal(task_id, signal.SIGCONT): bibsched_set_status(task_id, "ERROR", "SLEEPING") self.update_rows() self.repaint() self.display_in_footer("process woken up") else: self.display_in_footer("process is not sleeping") self.stdscr.refresh()
def debug_task(self): task_id = self.currentrow[0] bibsched_send_signal(task_id, signal.SIGUSR2) self.display_in_footer("Task set in debug mode")