forked from kubeflow/katib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(suggestion): Support advisor algorithms (kubeflow#4)
Signed-off-by: Ce Gao <gaoce@caicloud.io>
- Loading branch information
1 parent
cd6d1e8
commit 725c9bd
Showing
60 changed files
with
6,676 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import grpc | ||
from concurrent import futures | ||
|
||
import time | ||
|
||
from pkg.api.suggestion.v1alpha3.python import advisor_pb2_grpc | ||
from pkg.suggestion.v1alpha3.advisor.advisor import AdvisorUnifiedService | ||
from pkg.suggestion.v1alpha1.types import DEFAULT_PORT | ||
|
||
_ONE_DAY_IN_SECONDS = 60 * 60 * 24 | ||
|
||
|
||
def serve(): | ||
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) | ||
advisor_pb2_grpc.add_AdvisorSuggestionServicer_to_server( | ||
AdvisorUnifiedService(), server) | ||
server.add_insecure_port(DEFAULT_PORT) | ||
print("Listening...") | ||
server.start() | ||
try: | ||
while True: | ||
time.sleep(_ONE_DAY_IN_SECONDS) | ||
except KeyboardInterrupt: | ||
server.stop(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
serve() |
Oops, something went wrong.