Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
python-handel
Commits
60b6a8ca
Commit
60b6a8ca
authored
Sep 08, 2017
by
Vincent Michel
Committed by
U-ESRF\opid00
Sep 08, 2017
Browse files
Add handel-server to scripts
parent
c9cc7a17
Pipeline
#936
failed with stages
in 1 minute and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
scripts/handel-server
0 → 100755
View file @
60b6a8ca
#!/usr/bin/env python3
"""Serve the handel interface over the network using zerorpc.
This requires python3, handel, zerorpc and msgpack_numpy.
Usage:
$ ./handel-server 8888
Serving handel on tcp://0.0.0.0:8888 ...
Test on the client machine using:
$ zerorpc tcp://hostname:8888 -?
"""
# Imports
import
sys
import
functools
import
zerorpc
import
msgpack_numpy
import
handel.interface
as
hi
# Patching
msgpack_numpy
.
patch
()
print
=
functools
.
partial
(
print
,
flush
=
True
)
# Run server
def
run
(
bind
=
'0.0.0.0'
,
port
=
8000
):
access
=
"tcp://{}:{}"
.
format
(
bind
,
port
)
try
:
hi
.
init_handel
()
server
=
zerorpc
.
Server
(
hi
)
server
.
bind
(
access
)
print
(
f
'Serving handel on
{
access
}
...'
)
try
:
server
.
run
()
except
KeyboardInterrupt
:
print
(
'Interrupted.'
)
finally
:
server
.
close
()
finally
:
hi
.
exit
()
# Main function
def
main
(
args
=
None
):
if
args
is
None
:
args
=
sys
.
argv
if
len
(
args
)
>
1
:
run
(
port
=
int
(
args
[
1
]))
else
:
run
()
if
__name__
==
'__main__'
:
main
()
xmap
.ini
→
scripts/mercury
.ini
View file @
60b6a8ca
File moved
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment