Skip to content
Snippets Groups Projects
Commit 56e717b9 authored by Christoph Lange's avatar Christoph Lange
Browse files

add spectrometer server docu

parent 739ba98a
No related branches found
No related tags found
1 merge request!8add spectrometer server docu
Pipeline #211014 passed
...@@ -7,3 +7,18 @@ test: ...@@ -7,3 +7,18 @@ test:
- rm -rf build *.egg-info .tox - rm -rf build *.egg-info .tox
- tox --recreate - tox --recreate
pages:
image: python:3.11
script:
- pip install sphinx sphinx-click
- cd docs
- make html
- cd ..
- mkdir -p public
- cp -r docs/_build/html/* public
artifacts:
paths:
- public/
only:
- main
\ No newline at end of file
...@@ -35,7 +35,7 @@ To start the grpc server locally you may use this command: ...@@ -35,7 +35,7 @@ To start the grpc server locally you may use this command:
.. code-block:: .. code-block::
spectrometer start-server --grpc-channel 0.0.0.0:779 --spectrometer-channel 0 --log-level INFO --bwtek-dll-path C:\Users\BVT-Admin\git_projects\py-raman-chef\bwtek\BWTEKUSB.dll spectrometer-server start --grpc-channel 0.0.0.0:779 --spectrometer-channel 0 --log-level INFO --bwtek-dll-path C:\Users\BVT-Admin\git_projects\py-raman-chef\bwtek\BWTEKUSB.dll
Dockerfile Dockerfile
......
Command Line Interface
______________________
To start the spectrometer server you may use the following command.
.. click:: py_raman_chef.cli:server_group
:prog: spectrometer-server
:commands: start
:nested: full
...@@ -34,7 +34,7 @@ release = '0.0.1' ...@@ -34,7 +34,7 @@ release = '0.0.1'
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel'] extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', "sphinx_click.ext"]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
......
...@@ -7,6 +7,7 @@ py_raman_chef ...@@ -7,6 +7,7 @@ py_raman_chef
:maxdepth: 2 :maxdepth: 2
start_procedure start_procedure
cli
Purpose Purpose
......
...@@ -4,6 +4,7 @@ import grpc ...@@ -4,6 +4,7 @@ import grpc
import logging import logging
from signal import signal, SIGTERM from signal import signal, SIGTERM
from py_raman_chef.c_interface import close_spectrometer_connections
from py_raman_chef.grpc_interface.raman_chef_pb2_grpc import \ from py_raman_chef.grpc_interface.raman_chef_pb2_grpc import \
add_RamanChefServicer_to_server add_RamanChefServicer_to_server
from py_raman_chef.grpc_interface.server import SpectrometerServicer from py_raman_chef.grpc_interface.server import SpectrometerServicer
...@@ -14,7 +15,9 @@ def server_group(): ...@@ -14,7 +15,9 @@ def server_group():
pass pass
@server_group.command(help='Start Spectrometer Interaction Service') @server_group.command(
help='Start Spectrometer Server that handels recording spectra requests'
)
@click.option( @click.option(
'--grpc-channel', '--grpc-channel',
help='channel use for server client communication', help='channel use for server client communication',
...@@ -46,7 +49,7 @@ def server_group(): ...@@ -46,7 +49,7 @@ def server_group():
help='path where to find the the bwtek library', help='path where to find the the bwtek library',
type=str, type=str,
) )
def start_server( def start(
grpc_channel: str, grpc_channel: str,
spectrometer_channel: int, spectrometer_channel: int,
log_level: str, log_level: str,
...@@ -86,4 +89,7 @@ def start_server( ...@@ -86,4 +89,7 @@ def start_server(
signal(SIGTERM, handle_sigterm) signal(SIGTERM, handle_sigterm)
logger.info('Started the grpc_interface server for spectrometer interactions') logger.info('Started the grpc_interface server for spectrometer interactions')
grpc_server.wait_for_termination() try:
grpc_server.wait_for_termination()
finally:
close_spectrometer_connections(spectrometer_servicer.bwtek_dll)
from click.testing import CliRunner from click.testing import CliRunner
import pytest import pytest
from py_raman_chef.cli import start_server from py_raman_chef.cli import start
@pytest.mark.skip @pytest.mark.skip
...@@ -14,7 +14,7 @@ def test_start_server( ...@@ -14,7 +14,7 @@ def test_start_server(
# when # when
result = CliRunner().invoke( result = CliRunner().invoke(
start_server, start,
[ [
'--grpc-channel', local_channel, '--grpc-channel', local_channel,
'--spectrometer-channel', str(spectromeer_channel), '--spectrometer-channel', str(spectromeer_channel),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment