imporved son-monitor container startup and timeout
authorstevenvanrossem <steven.vanrossem@intec.ugent.be>
Thu, 9 Feb 2017 12:54:42 +0000 (13:54 +0100)
committerstevenvanrossem <steven.vanrossem@intec.ugent.be>
Thu, 9 Feb 2017 12:54:42 +0000 (13:54 +0100)
src/emuvim/dcemulator/monitoring.py

index d0e45da..de96e37 100755 (executable)
@@ -600,6 +600,17 @@ class DCNetworkMonitor():
                                           labels=['com.containernet'],\r
                                           name='skewmon'\r
                                           )\r
+            # Wait a while for containers to be completely started\r
+            started = False\r
+            wait_time = 0\r
+            while not started:\r
+                list1 = self.dockercli.containers.list(filters={'status': 'running', 'name': 'prometheus'})\r
+                if len(list1) >= 1:\r
+                    started = True\r
+                if wait_time > 5:\r
+                    return 'skewmon not started'\r
+                time.sleep(1)\r
+                wait_time += 1\r
         return ret\r
 \r
 \r