Threading pt 2 (of 3, likely)
[ric-plt/a1.git] / a1 / run.py
index 67f63d6..c15b644 100644 (file)
--- a/a1/run.py
+++ b/a1/run.py
@@ -17,8 +17,6 @@ A1 entrypoint
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 # ==================================================================================
-import time
-from threading import Thread
 from gevent.pywsgi import WSGIServer
 from a1 import get_module_logger, app
 from a1 import a1rmr
@@ -27,24 +25,11 @@ from a1 import a1rmr
 logger = get_module_logger(__name__)
 
 
-def start_rmr_thread(real_init=True):
-    """
-    Start a1s rmr thread
-    Also called during unit testing
-    """
-    rmr_loop = a1rmr.RmrLoop(real_init)
-    thread = Thread(target=rmr_loop.loop)
-    thread.start()
-    while not rmr_loop.rmr_is_ready():
-        time.sleep(0.5)
-    return rmr_loop  # return the handle; useful during unit testing
-
-
 def main():
     """Entrypoint"""
     # start rmr thread
     logger.debug("Initializing rmr thread. A1s webserver will not start until rmr initialization is complete.")
-    start_rmr_thread()
+    a1rmr.start_rmr_thread()
 
     # start webserver
     logger.debug("Starting gevent server")