def process_annotask(self, pipe_e): anno_task = self.dbm.get_anno_task(pipe_element_id=pipe_e.idx) if anno_task.state == state.AnnoTask.IN_PROGRESS or \ anno_task.state == state.AnnoTask.PAUSED: if not at_man.has_annotation(self.dbm, anno_task.idx): at_man.set_finished(self.dbm, anno_task.idx) self.logger.warning('No Annotations have been requested for AnnoTask {}'\ .format(anno_task.idx)) self.logger.warning("%d: AnnoTask has been finished (ID: %d, Name: %s)"\ %(self.pipe.idx, anno_task.idx, anno_task.name)) # if pipe_e.anno_task.dtype == dtype.AnnoTask.MIA: # if anno_task.progress is None: # anno_task.progress = 0.0 # if anno_task.progress >= 100.0: # anno_task.state = state.AnnoTask.FINISHED # self.dbm.add(anno_task) # pipe_e.state = state.PipeElement.FINISHED # self.dbm.add(pipe_e) # self.dbm.commit() # print("%d: AnnoTask has been finished (ID: %d, Name: %s)"\ # %(self.pipe.idx, anno_task.idx, anno_task.name)) # else: # return # state = finished will be set in annotation tool if anno_task.state == state.AnnoTask.PENDING: anno_task.state = state.AnnoTask.IN_PROGRESS self.dbm.save_obj(anno_task) self.logger.info("%d: AnnoTask IN_PROGRESS (ID: %d, Name: %s)"\ %(self.pipe.idx, anno_task.idx, anno_task.name))
def finish(db_man, user_id): at = get_sia_anno_task(db_man, user_id) if at.idx: return set_finished(db_man, at.idx) else: return "error: anno_task not found"