diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-01-11 18:58:06 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-01-15 10:45:07 -0800 |
commit | 66d0257b2e3a0e4bdb02b2511881863059a1e5a5 (patch) | |
tree | 2ca254bbefaff30f68ac63a4397f3ea814d42f7d /mpm/python/usrp_hwd.py | |
parent | 032e483adcd0084d5479ac36c6586f7518805de3 (diff) | |
download | uhd-66d0257b2e3a0e4bdb02b2511881863059a1e5a5.tar.gz uhd-66d0257b2e3a0e4bdb02b2511881863059a1e5a5.tar.bz2 uhd-66d0257b2e3a0e4bdb02b2511881863059a1e5a5.zip |
mpm: Enable systemd watchdog and update it from MPM
- Updated systemd service file
- Added health status flag in shared data object
- Added thread in RPC process to update watchdog
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Diffstat (limited to 'mpm/python/usrp_hwd.py')
-rwxr-xr-x | mpm/python/usrp_hwd.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mpm/python/usrp_hwd.py b/mpm/python/usrp_hwd.py index e4f64b2f0..b4d556cfd 100755 --- a/mpm/python/usrp_hwd.py +++ b/mpm/python/usrp_hwd.py @@ -15,6 +15,7 @@ from gevent import signal from gevent.hub import BlockingSwitchOutError import usrp_mpm as mpm from usrp_mpm.mpmtypes import SharedState +from usrp_mpm.sys_utils import watchdog _PROCESSES = [] @@ -147,17 +148,21 @@ def spawn_processes(log, args): log.info("Spawning RPC process...") _PROCESSES.append( mpm.spawn_rpc_process(mpm.mpmtypes.MPM_RPC_PORT, shared, args)) + log.debug("RPC process has PID: %d", _PROCESSES[-1].pid) + if watchdog.has_watchdog(): + watchdog.transfer_control(_PROCESSES[-1].pid) log.info("Spawning discovery process...") _PROCESSES.append( mpm.spawn_discovery_process(shared, args.discovery_addr) ) + log.debug("Discovery process has PID: %d", _PROCESSES[-1].pid) log.info("Processes launched. Registering signal handlers.") signal.signal(signal.SIGTERM, kill_time) signal.signal(signal.SIGINT, kill_time) - signal.pause() + for proc in _PROCESSES: + proc.join() return True - def main(): """ Go, go, go! |