From 546aa04355ff34924ce1d00fd003cb0ee63c8cf9 Mon Sep 17 00:00:00 2001 From: Trung N Tran Date: Fri, 27 Apr 2018 15:27:13 -0700 Subject: mpm: replace long execution function with async call - Replace mykonos finish_initialization with async version - Replace myknonos setup_cal with async version - Remove disable_timeout on rpc_server init() --- mpm/python/usrp_mpm/mpmutils.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'mpm/python/usrp_mpm/mpmutils.py') diff --git a/mpm/python/usrp_mpm/mpmutils.py b/mpm/python/usrp_mpm/mpmutils.py index 539cd8de4..151713988 100644 --- a/mpm/python/usrp_mpm/mpmutils.py +++ b/mpm/python/usrp_mpm/mpmutils.py @@ -8,7 +8,6 @@ Miscellaneous utilities for MPM """ import time -import sys def poll_with_timeout(state_check, timeout_ms, interval_ms): """ @@ -150,3 +149,17 @@ def str2bool(value): except AttributeError: return bool(value) + +def async_exec(parent, method_name, *args): + """Execute method_name asynchronously. + Requires the parent class to have this feature enabled. + """ + async_name = 'async__' + method_name + await_name = 'await__' + method_name + # Spawn async + getattr(parent, async_name)(*args) + awaitable_method = getattr(parent, await_name) + # await + while not awaitable_method(): + time.sleep(0.1) + -- cgit v1.2.3