aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/rpc_server.py
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-01-11 18:58:06 -0800
committerMartin Braun <martin.braun@ettus.com>2018-01-15 10:45:07 -0800
commit66d0257b2e3a0e4bdb02b2511881863059a1e5a5 (patch)
tree2ca254bbefaff30f68ac63a4397f3ea814d42f7d /mpm/python/usrp_mpm/rpc_server.py
parent032e483adcd0084d5479ac36c6586f7518805de3 (diff)
downloaduhd-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_mpm/rpc_server.py')
-rw-r--r--mpm/python/usrp_mpm/rpc_server.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mpm/python/usrp_mpm/rpc_server.py b/mpm/python/usrp_mpm/rpc_server.py
index 5e8601bbd..60de43994 100644
--- a/mpm/python/usrp_mpm/rpc_server.py
+++ b/mpm/python/usrp_mpm/rpc_server.py
@@ -25,6 +25,7 @@ from six import iteritems
from mprpc import RPCServer
from usrp_mpm.mpmlog import get_main_logger
from usrp_mpm.mpmutils import to_binary_str
+from usrp_mpm.sys_utils import watchdog
TIMEOUT_INTERVAL = 3.0 # Seconds before claim expires
TOKEN_LEN = 16 # Length of the token string
@@ -81,6 +82,14 @@ class MPMServer(RPCServer):
super(MPMServer, self).__init__(
pack_params={'use_bin_type': True},
)
+ self._state.system_ready.value = True
+ self.log.info("RPC server ready!")
+ # Optionally spawn watchdog. Note: In order for us to be able to spawn
+ # the task from this thread, the main process needs to hand control to
+ # us using watchdog.transfer_control().
+ if watchdog.has_watchdog():
+ self.log.info("Spawning watchdog task...")
+ watchdog.spawn_watchdog_task(self._state, self.log)
def _init_rpc_calls(self, mgr):
"""