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
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
def test_GetProduceSolutionResults(): req = core_pb2.GetProduceSolutionResultsRequest( request_id=get_request_id_str()) print(MessageToJson(req, including_default_value_fields=True)) 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'))) print(MessageToJson(resp, including_default_value_fields=True))
def test_GetScoreSolutionResults(): req = core_pb2.GetScoreSolutionResultsRequest( request_id=get_request_id_str()) print(MessageToJson(req, including_default_value_fields=True)) score_list = [] for _loop in range(0, random.randint(1, 3)): score_list.append(get_score()) resp = core_pb2.GetScoreSolutionResultsResponse(\ progress=get_progress(), scores=score_list) print(MessageToJson(resp, including_default_value_fields=True))
def test_GetSearchSolutionsResults(): """work out the req/resp""" req = core_pb2.GetSearchSolutionsResultsRequest(\ search_id=get_search_id_str()) print(MessageToJson(req)) score_list = [] for _loop in range(0, random.randint(1, 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) print(MessageToJson(resp, including_default_value_fields=True))