Exemple #1
0
 def update(self):
     if self.at.pipe_element.pipe.state == state.Pipe.PAUSED:
         return "pipe is paused"
     if self.b_boxes is not None:
         self.__update_drawables(self.b_boxes, dtype.TwoDAnno.BBOX)
     if self.points is not None:
         self.__update_drawables(self.points, dtype.TwoDAnno.POINT)
     if self.lines is not None:
         self.__update_drawables(self.lines, dtype.TwoDAnno.LINE)
     if self.polygons is not None:
         self.__update_drawables(self.polygons, dtype.TwoDAnno.POLYGON)
     self.image_anno.state = state.Anno.LABELED
     self.db_man.add(self.image_anno)
     self.db_man.commit()
     self.__update_history_json_file()
     update_anno_task(self.db_man, self.at.idx, self.user_id)
     return "success"
Exemple #2
0
 def process_pipe_element(self):
     pipe_e = self.get_next_element()
     while (pipe_e is not None):
         # if pipe_e is None:
         #     return
         if pipe_e.dtype == dtype.PipeElement.SCRIPT:
             if pipe_e.state != state.PipeElement.SCRIPT_ERROR:
                 # if pipe_e.is_debug_mode:
                 #     pipe_e.state = state.PipeElement.IN_PROGRESS
                 #     self.dbm.save_obj(pipe_e)
                 #     self.make_debug_session(pipe_e)
                 # else:
                 if pipe_e.state == state.PipeElement.PENDING:
                     env = self.select_env_for_script(pipe_e)
                     if env is None:
                         return
                     celery_exec_script.apply_async(args=[pipe_e.idx],
                                                    queue=env)
         elif pipe_e.dtype == dtype.PipeElement.ANNO_TASK:
             if pipe_e.state == state.PipeElement.PENDING:
                 update_anno_task(self.dbm, pipe_e.anno_task.idx)
                 try:
                     email.send_annotask_available(self.dbm,
                                                   pipe_e.anno_task)
                 except:
                     msg = "Could not send Email. \n"
                     msg += traceback.format_exc()
                     self.logger.error(msg)
                 pipe_e.state = state.PipeElement.IN_PROGRESS
                 self.dbm.save_obj(pipe_e)
             self.process_annotask(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.DATASOURCE:
             pipe_e.state = state.PipeElement.FINISHED
             self.dbm.save_obj(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.VISUALIZATION:
             pipe_e.state = state.PipeElement.FINISHED
             self.dbm.save_obj(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.DATA_EXPORT:
             pipe_e.state = state.PipeElement.FINISHED
             self.dbm.save_obj(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.LOOP:
             self.process_loop(pipe_e)
             self.dbm.commit()
         pipe_e = self.get_next_element()
Exemple #3
0
 def process_pipe_element(self):
     pipe_e = self.get_next_element()
     while (pipe_e is not None):
         # if pipe_e is None:
         #     return
         if pipe_e.dtype == dtype.PipeElement.SCRIPT:
             if pipe_e.state != state.PipeElement.SCRIPT_ERROR:
                 # if pipe_e.is_debug_mode:
                 #     pipe_e.state = state.PipeElement.IN_PROGRESS
                 #     self.dbm.save_obj(pipe_e)
                 #     self.make_debug_session(pipe_e)
                 # else:
                 if pipe_e.state == state.PipeElement.PENDING:
                     self.start_script(pipe_e)
                     pipe = pipe_e.pipe
                     self.logger.info('PipeElementID: {} Excuting script: {}'.format(pipe_e.idx, 
                         pipe_e.script.name))
         elif pipe_e.dtype == dtype.PipeElement.ANNO_TASK:
             if pipe_e.state == state.PipeElement.PENDING:
                 update_anno_task(self.dbm, pipe_e.anno_task.idx)
                 try: 
                     email.send_annotask_available(self.dbm, pipe_e.anno_task)
                 except:
                     msg = "Could not send Email. \n"
                     msg += traceback.format_exc()
                     self.logger.error(msg)
                 pipe_e.state = state.PipeElement.IN_PROGRESS
                 self.dbm.save_obj(pipe_e)
             self.process_annotask(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.DATASOURCE:
             pipe_e.state = state.PipeElement.FINISHED
             self.dbm.save_obj(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.VISUALIZATION:
             pipe_e.state = state.PipeElement.FINISHED
             self.dbm.save_obj(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.DATA_EXPORT:
             pipe_e.state = state.PipeElement.FINISHED
             self.dbm.save_obj(pipe_e)
         elif pipe_e.dtype == dtype.PipeElement.LOOP:
             self.process_loop(pipe_e)
             self.dbm.commit()
         pipe_e = self.get_next_element()
Exemple #4
0
 def update(self, auto_save=False):
     if self.at.pipe_element.pipe.state == state.Pipe.PAUSED:
         return "pipe is paused"
     if self.b_boxes is not None:
         self.__update_annotations(self.b_boxes, dtype.TwoDAnno.BBOX)
     if self.points is not None:
         self.__update_annotations(self.points, dtype.TwoDAnno.POINT)
     if self.lines is not None:
         self.__update_annotations(self.lines, dtype.TwoDAnno.LINE)
     if self.polygons is not None:
         self.__update_annotations(self.polygons, dtype.TwoDAnno.POLYGON)
     if not auto_save:
         self.image_anno.state = state.Anno.LABELED
     # Update Image Label
     # self.image_anno.labels = self.img_labels
     self.db_man.add(self.image_anno)
     self.db_man.commit()
     # self.__update_history_json_file()
     update_anno_task(self.db_man, self.at.idx, self.user_id)
     return "success"
Exemple #5
0
def update(db_man, user_id, data):
    at = __get_mia_anno_task(db_man, user_id)
    if at and at.pipe_element.pipe.state != state.Pipe.PAUSED:
        config = json.loads(at.configuration)
        if config['type'] == 'annoBased':
            __update_two_d_annotation(db_man, user_id, data)
        elif config['type'] == 'imageBased':
            __update_image_annotation(db_man, user_id, data)

        return update_anno_task(db_man, at.idx, user_id)
    # get all labels
    # get all active images
    # add labels
    # set status locked priority of inactive
    # set status labeled
    # update anno task progress
    return "error"