Exemplo n.º 1
0
 def UpdateBento(self, request, context=None):
     bento_id = f"{request.bento_name}_{request.bento_version}"
     with lock(self.db, [(bento_id, LockType.WRITE)]) as (sess, _):
         try:
             # TODO: validate request
             if request.upload_status:
                 self.db.metadata_store.update_upload_status(
                     sess,
                     request.bento_name,
                     request.bento_version,
                     request.upload_status,
                 )
             if request.service_metadata:
                 self.db.metadata_store.update(
                     sess,
                     request.bento_name,
                     request.bento_version,
                     request.service_metadata,
                 )
             return UpdateBentoResponse(status=Status.OK())
         except BentoMLException as e:
             logger.error("RPC ERROR UpdateBento: %s", e)
             return UpdateBentoResponse(status=e.status_proto)
         except Exception as e:  # pylint: disable=broad-except
             logger.error("RPC ERROR UpdateBento: %s", e)
             return UpdateBentoResponse(status=Status.INTERNAL())
Exemplo n.º 2
0
 def UpdateBento(self, request, context=None):
     with self.db.create_session() as sess:
         try:
             # TODO: validate request
             if request.upload_status:
                 self.db.metadata_store.update_upload_status(
                     sess,
                     request.bento_name,
                     request.bento_version,
                     request.upload_status,
                 )
             if request.service_metadata:
                 self.db.metadata_store.update(
                     sess,
                     request.bento_name,
                     request.bento_version,
                     request.service_metadata,
                 )
             return UpdateBentoResponse(status=Status.OK())
         except BentoMLException as e:
             logger.error("RPC ERROR UpdateBento: %s", e)
             return UpdateBentoResponse(status=e.status_proto)
         except Exception as e:  # pylint: disable=broad-except
             logger.error("RPC ERROR UpdateBento: %s", e)
             return UpdateBentoResponse(status=Status.INTERNAL())