def init_task(self): task_id = self.currentrow[0] status = self.currentrow[5] if status not in ('RUNNING', 'CONTINUING', 'SLEEPING'): bibsched_set_status(task_id, "WAITING") bibsched_set_progress(task_id, "") bibsched_set_host(task_id, "") self.update_rows() self.repaint() self.display_in_footer("process initialised") else: self.display_in_footer("Cannot initialise running processes")
def run(self, *args, **kwargs): # clean up queue tasks = webapi.get_bibsched_tasks() for t in tasks: task_id, proc, priority, user, runtime, status, progress = t if 'ERROR' in status: logger.info("Re-init task %s", task_id) cli.bibsched_set_status(task_id, "WAITING") cli.bibsched_set_progress(task_id, "") cli.bibsched_set_host(task_id, "") if webapi.get_bibsched_mode() != 'AUTOMATIC': # manual, put it back to auto logger.info("Putting back bibsched to auto mode") run_sql('UPDATE schSTATUS SET value = "" WHERE ' 'name = "resume_after"') run_sql('UPDATE schSTATUS SET value = "1" WHERE ' 'name = "auto_mode"')