Commit 3c491e17 authored by Vincent Michel's avatar Vincent Michel
Browse files

Simplify handel-server

parent 5c16591e
Pipeline #1251 passed with stages
in 1 minute and 20 seconds
...@@ -7,7 +7,7 @@ This requires python3, handel, zerorpc and msgpack_numpy. ...@@ -7,7 +7,7 @@ This requires python3, handel, zerorpc and msgpack_numpy.
Usage: Usage:
$ ./handel-server 8888 $ ./handel-server 8888
Serving handel on tcp://0.0.0.0:8888 ... Serving handel on tcp://0.0.0.0:8888 ...
Test on the client machine using: Test on the client machine using:
...@@ -17,7 +17,6 @@ Test on the client machine using: ...@@ -17,7 +17,6 @@ Test on the client machine using:
# Imports # Imports
import sys import sys
import functools
import zerorpc import zerorpc
import msgpack_numpy import msgpack_numpy
...@@ -28,7 +27,6 @@ import handel.interface as hi ...@@ -28,7 +27,6 @@ import handel.interface as hi
# Patching # Patching
msgpack_numpy.patch() msgpack_numpy.patch()
print = functools.partial(print, flush=True)
# Run server # Run server
...@@ -39,7 +37,7 @@ def run(bind='0.0.0.0', port=8000): ...@@ -39,7 +37,7 @@ def run(bind='0.0.0.0', port=8000):
hi.init_handel() hi.init_handel()
server = zerorpc.Server(hi) server = zerorpc.Server(hi)
server.bind(access) server.bind(access)
print(f'Serving handel on {access} ...') print('Serving handel on {} ...'.format(access))
try: try:
server.run() server.run()
except KeyboardInterrupt: except KeyboardInterrupt:
...@@ -50,7 +48,7 @@ def run(bind='0.0.0.0', port=8000): ...@@ -50,7 +48,7 @@ def run(bind='0.0.0.0', port=8000):
hi.exit() hi.exit()
# Main function # Main function
def main(args=None): def main(args=None):
if args is None: if args is None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment