Skip to content

Commit

Permalink
fix: Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <gaoce@caicloud.io>
  • Loading branch information
gaocegege committed Sep 24, 2019
1 parent 895c431 commit 1a691cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cmd/suggestion/hyperband/v1alpha3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
DEFAULT_PORT = "0.0.0.0:6789"


def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
service = HyperbandService()
api_pb2_grpc.add_SuggestionServicer_to_server(service, server) health_pb2_grpc.add_HealthServicer_to_server(service, server)
api_pb2_grpc.add_SuggestionServicer_to_server(service, server)
health_pb2_grpc.add_HealthServicer_to_server(service, server)

server.add_insecure_port(DEFAULT_PORT)
print("Listening...")
Expand All @@ -22,5 +24,6 @@ def serve():
except KeyboardInterrupt:
server.stop(0)


if __name__ == "__main__":
serve()
3 changes: 2 additions & 1 deletion pkg/suggestion/v1alpha3/hyperband_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def GetSuggestions(self, request, context):
try:
reply = api_pb2.GetSuggestionsReply()
experiment = request.experiment
self.all_trials = request.trials
alg_settings = experiment.spec.algorithm.algorithm_setting

param = HyperBandParam.convert(alg_settings)
Expand Down Expand Up @@ -126,7 +127,7 @@ def get_objective_value(t):
return float(m.value)

top_trials = []
all_trials = self._get_trials(experiment.name)
all_trials = self.all_trials
latest_trials = self._get_last_trials(all_trials, latest_trials_num)

for t in latest_trials:
Expand Down

0 comments on commit 1a691cd

Please sign in to comment.