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()
Beispiel #2
0
 def list_metric_evals_route(self, request):
     experiment = plugin_util.experiment_id(request.environ)
     try:
         request_proto = _parse_request_argument(
             request, 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, experiment
                 ).run()
             ),
             "application/json",
         )
     except error.HParamsError as e:
         logger.error("HParams error: %s" % e)
         raise werkzeug.exceptions.BadRequest(description=str(e))
Beispiel #3
0
 def list_metric_evals_route(self, request):
   try:
     request_proto = _parse_request_argument(
         request, 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))
Beispiel #4
0
 def list_metric_evals_route(self, request):
     ctx = plugin_util.context(request.environ)
     experiment_id = plugin_util.experiment_id(request.environ)
     try:
         request_proto = _parse_request_argument(
             request, api_pb2.ListMetricEvalsRequest)
         scalars_plugin = self._get_scalars_plugin()
         if not scalars_plugin:
             raise werkzeug.exceptions.NotFound("Scalars plugin not loaded")
         return http_util.Respond(
             request,
             json.dumps(
                 list_metric_evals.Handler(ctx, request_proto,
                                           scalars_plugin,
                                           experiment_id).run()),
             "application/json",
         )
     except error.HParamsError as e:
         logger.error("HParams error: %s" % e)
         raise werkzeug.exceptions.BadRequest(description=str(e))