Merge pull request #64 from janspeller/feature/sdrInput_improvements

Add 10s timeout and restart multimon if rtl_fm crashes & fix pytest and codingstyle-failures
This commit is contained in:
Bastian Schroll 2021-01-08 10:16:58 +01:00 committed by GitHub
commit fc64f033d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

View file

@ -8,7 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: [3.5, 3.6, 3.7, 3.8] python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
steps: steps:

View file

@ -15,6 +15,7 @@
@description: Input source for sdr with rtl_fm @description: Input source for sdr with rtl_fm
""" """
import logging import logging
import time
from boswatch.utils import paths from boswatch.utils import paths
from boswatch.processManager import ProcessManager from boswatch.processManager import ProcessManager
from boswatch.inputSource.inputBase import InputBase from boswatch.inputSource.inputBase import InputBase
@ -47,8 +48,14 @@ class SdrInput(InputBase):
logging.info("start decoding") logging.info("start decoding")
while self._isRunning: while self._isRunning:
if not sdrProc.isRunning: if not sdrProc.isRunning:
logging.warning("rtl_fm was down - try to restart") logging.warning("rtl_fm was down - trying to restart in 10 seconds")
time.sleep(10)
sdrProc.start() sdrProc.start()
if sdrProc.isRunning:
logging.info("rtl_fm is back up - restarting multimon...")
mmProc.setStdin(sdrProc.stdout)
mmProc.start()
elif not mmProc.isRunning: elif not mmProc.isRunning:
logging.warning("multimon was down - try to restart") logging.warning("multimon was down - try to restart")
mmProc.start() mmProc.start()

View file

@ -9,6 +9,6 @@ mkdocs
# for develope only # for develope only
pytest pytest
pytest-cov pytest-cov
pytest-pep8 pytest-flake8
pytest-flakes pytest-flakes
pytest-randomly pytest-randomly

View file

@ -8,7 +8,7 @@
# by Bastian Schroll # by Bastian Schroll
[pytest] [pytest]
addopts = -v --pep8 --flakes --cov=boswatch/ --cov=module/ --cov plugin/ --cov-report=term-missing --log-level=CRITICAL addopts = -v --flake8 --flakes --cov=boswatch/ --cov=module/ --cov plugin/ --cov-report=term-missing --log-level=CRITICAL
# classic or progress # classic or progress
console_output_style = progress console_output_style = progress
@ -18,8 +18,11 @@ log_file_level=debug
log_file_format=%(asctime)s - %(module)-12s %(funcName)-15s [%(levelname)-8s] %(message)s log_file_format=%(asctime)s - %(module)-12s %(funcName)-15s [%(levelname)-8s] %(message)s
log_file_date_format=%d.%m.%Y %H:%M:%S log_file_date_format=%d.%m.%Y %H:%M:%S
#pep8 plugin #flake8 plugin
pep8ignore = E402 E501 flake8-ignore = E402 E501 E722 W504 W605
# E402 # import not at top # E402 # import not at top
# E501 # line too long # E501 # line too long
# pep8maxlinelength = 99 # E722 # do not use bare 'except'
# W504 # line break after binary operator
# W605 # invalid escape sequence
# flake8-max-line-length = 99