示例#1
0
    def Suggest(self, request, context):  # pylint: disable=unused-argument
        # TODO: return an error if optimizer not found
        #
        with self.exclusive_optimizer(
                optimizer_id=request.OptimizerHandle.Id) as optimizer:
            suggested_params = optimizer.suggest(random=request.Random,
                                                 context=request.Context)

        return OptimizerService_pb2.ConfigurationParameters(
            ParametersJsonString=json.dumps(suggested_params.to_dict()))
示例#2
0
    def Suggest(self, request, context): # pylint: disable=unused-argument
        self.logger.info("Suggesting")

        # TODO: return an error if optimizer not found
        #
        if request.Context.ContextJsonString != "":
            raise NotImplementedError("Context not currently supported in remote optimizers")
        with self.exclusive_optimizer(optimizer_id=request.OptimizerHandle.Id) as optimizer:
            # TODO handle context here
            suggested_params = optimizer.suggest(random=request.Random)

        return OptimizerService_pb2.ConfigurationParameters(
            ParametersJsonString=json.dumps(suggested_params.to_dict())
        )