gRPC (http://www.grpc.io/) server for Xenon (https://xenon-middleware.github.io/xenon/).
Can be used to use Xenon in a non-java based language. For example pyxenon (https://github.com/NLeSC/pyxenon) uses the Xenon gRPC server.
The server tries to mimic the Xenon library API as much as possible, differences are described in the proto file .
On releases page download a tarball (or zipfile).
The tarball can be installed with:
tar -xf xenon-grpc-shadow*.tar
Add xenon-grpc*/bin
to your PATH environment variable for easy usage.
To start the grpc server with default arguments run
./xenon-grpc*/bin/xenon-grpc
To get help run
./xenon-grpc*/bin/xenon-grpc --help
Or call the jar directly with
java -jar xenon-grpc-*/lib/xenon-grpc-*-all.jar
./gradlew installDist
./build/install/xenon-grpc/bin/xenon-grpc
For use polyglot
wget https://github.com/grpc-ecosystem/polyglot/releases/download/v2.0.0/polyglot.jar
java -jar polyglot.jar --proto_discovery_root=src/main/proto list_services
echo {} | java -jar polyglot.jar call --endpoint=localhost:50051 --full_method=xenon.SchedulerService/getAdaptorDescriptions
Compile proto into python stubs
pip install grpcio grpcio-tools
xenon-grpc --proto > xenon.proto
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. xenon.proto
Now use the generated stubs, see https://grpc.io/docs/tutorials/basic/python.html#creating-the-client
Create self-signed certificate and use for server and client on same machine.
Make sure Common Name
field is filled with hostname of machine.
See http://httpd.apache.org/docs/2.4/ssl/ssl_faq.html#selfcert
openssl req -new -x509 -nodes -out server.crt -keyout server.key
./build/install/xenon-grpc/bin/xenon-grpc --server-cert-chain server.crt --server-private-key server.key --client-cert-chain server.crt
Test with polyglot
echo {} | java -jar polyglot.jar call --endpoint=<hostname as used in certificate>:50051 --full_method=xenon.FileSystemService/getAdaptorNames --use_tls=true --tls_client_cert_path=$PWD/server.crt --tls_client_key_path=$PWD/server.key --tls_ca_cert_path=$PWD/server.crt
In a ipython shell with generated stubs in working directory:
import grpc
import xenon_pb2
import xenon_pb2_grpc
import socket
creds = grpc.ssl_channel_credentials(
root_certificates=open('../../../server.crt').read(),
private_key=open('../../../server.key', 'rb').read(),
certificate_chain=open('../../../server.crt', 'rb').read()
)
channel = grpc.secure_channel(socket.gethostname() + ':50051', creds)
stub = xenon_pb2_grpc.XenonJobsStub(channel)
response = stub.getAdaptorDescriptions(xenon_pb2.Empty())
print(response)
./gradlew build
Generates application tar/zip in build/distributions/
directory.
- Bump version in
build.gradle
,CITATION.cff
, add version toCHANGELOG.md
and commit/push - Create a new GitHub release
- Upload the files in
build/distributions/
directory to that release - Publish release
- Edit Zenodo entry, add Xenon doi as
is referenced by this upload
.