def _run_handler(self, request):
     request_proto = api_pb2.ListMetricEvalsRequest()
     text_format.Merge(request, request_proto)
     handler = list_metric_evals.Handler(
         request_proto, self._mock_scalars_plugin
     )
     return handler.run()
Example #2
0
 def list_metric_evals_route(self, request):
   try:
     _verify_request_is_post(request, '/metric_evals')
     request_proto = json_format.Parse(request.data,
                                       api_pb2.ListMetricEvalsRequest())
     scalars_plugin = self._get_scalars_plugin()
     if not scalars_plugin:
       raise error.HParamsError('Internal error: the scalars plugin is not'
                                ' registered; yet, the hparams plugin is'
                                ' active.')
     return http_util.Respond(
         request,
         json.dumps(
             list_metric_evals.Handler(request_proto, scalars_plugin).run()),
         'application/json')
   except error.HParamsError as e:
     logger.error('HParams error: %s' % e)
     raise werkzeug.exceptions.BadRequest(description=str(e))