Ejemplo n.º 1
0
    def GetSearchSolutionsResults(self, request, context):
        """grpc GetSearchSolutionsResults call"""
        msgd(self.GetSearchSolutionsResults.__doc__)

        total_loops = 3
        for loop_num in range(total_loops):
            # pause 1, 3 seconds...
            pause_secs = random.randint(1, 3)
            print('(loop %d/%d) pausing %d seconds' % \
                 ((loop_num + 1), total_loops, pause_secs))
            time.sleep(pause_secs)

            score_list = []
            for _loop in range(0, random.randint(0, 3)):
                score_list.append(get_solution_search_score())

            resp = core_pb2.GetSearchSolutionsResultsResponse(\
                        progress=get_progress(),
                        done_ticks=random.randint(1, 9),
                        all_ticks=10,
                        solution_id=get_solution_id_str(),
                        internal_score=0,
                        scores=score_list)

            self.print_resp(resp)

            yield resp
Ejemplo n.º 2
0
    def GetProduceSolutionResults(self, request, context):
        """grpc GetProduceSolutionResults call"""
        msgd(self.GetProduceSolutionResults.__doc__)

        total_loops = 3
        for loop_num in range(total_loops):
            # pause 1, 3 seconds...
            pause_secs = random.randint(1, 3)
            print('(loop %d/%d) pausing %d seconds' % \
                 ((loop_num + 1), total_loops, pause_secs))
            time.sleep(pause_secs)

            step_progress = core_pb2.StepProgress(\
                        progress=get_progress(no_errors=True),
                        steps=[core_pb2.StepProgress(\
                                progress=get_progress(no_errors=True))])

            resp = core_pb2.GetProduceSolutionResultsResponse(\
                    progress=get_progress(no_errors=True),
                    steps=[step_progress],
                    exposed_outputs=dict(\
                        key1=value_pb2.Value(csv_uri='file://uri/to-a/csv'),
                        key2=value_pb2.Value(dataset_uri='file://uri/to-a/dataset')))

            yield resp
Ejemplo n.º 3
0
    def DescribeSolution(self, request, context):
        """grpc DescribeSolution call"""
        msgd(self.DescribeSolution.__doc__)

        resp = get_DescribeSolutionResponse()

        self.print_resp(resp)

        return resp
Ejemplo n.º 4
0
    def StopSearchSolutions(self, request, context):
        """grpc StopSearchSolutions call"""
        msgd(self.StopSearchSolutions.__doc__)

        resp = core_pb2.StopSearchSolutionsResponse()

        self.print_resp(resp)

        return resp
Ejemplo n.º 5
0
    def UpdateProblem(self, request, context):
        """grpc UpdateProblem call"""
        msgd(self.UpdateProblem.__doc__)

        resp = core_pb2.UpdateProblemResponse()

        self.print_resp(resp)

        return resp
Ejemplo n.º 6
0
    def SolutionExport(self, request, context):
        """grpc SolutionExport call"""
        msgd(self.SolutionExport.__doc__)

        resp = core_pb2.SolutionExportResponse()

        self.print_resp(resp)

        return resp
Ejemplo n.º 7
0
    def SearchSolutions(self, request, context):
        """grpc SearchSolutions call"""
        msgd(self.SearchSolutions.__doc__)

        resp = core_pb2.SearchSolutionsResponse(\
                    search_id=get_search_id_str())

        self.print_resp(resp)

        return resp
Ejemplo n.º 8
0
    def ProduceSolution(self, request, context):
        """grpc ProduceSolution call"""
        msgd(self.ProduceSolution.__doc__)

        resp = core_pb2.ProduceSolutionResponse(\
                    request_id=get_request_id_str())

        self.print_resp(resp)

        return resp
Ejemplo n.º 9
0
    def ListPrimitives(self, request, context):
        """grpc ListPrimitives call"""
        msgd(self.ListPrimitives.__doc__)

        resp = core_pb2.ListPrimitivesResponse(\
                    primitives=[get_primitive(),
                                get_primitive(),
                                get_primitive()])

        self.print_resp(resp)

        return resp
Ejemplo n.º 10
0
    def Hello(self, request, context):
        """grpc Hello call"""
        msgd(self.Hello.__doc__)
        version = get_api_version()

        resp = core_pb2.HelloResponse(
            user_agent='TA2-aromatic roaster',
            version=version,
        )

        for val in ALLOWED_VALUE_TYPES:
            resp.allowed_value_types.append(val)

        #for val in ['.not', '.quite', '.sure']:
        #    resp.supported_extensions.append(val)

        self.print_resp(resp)

        return resp