示例#1
0
 def update_state(self, state=None, payload=None):
     """
     Updates the state of the EvaluationEndpointService
     
     :param state: The new state. If not given, the current state will be used.
     :param payload: Additional data to attach to the state
     """
     try:
         with self._status_lock.writer_lock:
             state = state or self._status.state
             ver = self._status.object_info.resource_version + 1
             info = ObjectInfo('EvaluationInstanceStatus',
                               resource_version=ver)
             self._status = EvaluationInstanceStatus(info,
                                                     state=state,
                                                     payload=payload)
             watch_manager.notify_watch('status', item=self._status)
     except RuntimeError as inst:
         msg = "Runtime Error while updating state of EvaluationEndpointService: %s" % str(
             inst)
         logger.exception(msg)
         return ServiceError(500, msg), 500
     except Exception as ex:
         msg = "Exception while updating state of EvaluationPluginService: %s" % str(
             ex)
         logger.exception(msg)
         return ServiceError(500, msg), 500
示例#2
0
文件: service.py 项目: ossys/mistk
 def update_state(self, state=None, payload=None):
     """
     Updates the state of the ModelEndpointService
     
     :param state: The new state. If not given, the current state will be used.
     :param payload: Additional data to attach to the state
     """
     try:
         with self._status_lock.writer_lock:
             state = state or self._status.state
             ver = self._status.object_info.resource_version + 1
             info = ObjectInfo('ModelInstanceStatus', resource_version=ver)
             self._status = ModelInstanceStatus(info,
                                                state=state,
                                                payload=payload)
             watch_manager.notify_watch('status', item=self._status)
     except RuntimeError as inst:
         return ServiceError(500, str(inst)), 500