This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Holger Freyther gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/6234
WIP.. figure out asyncio..
Change-Id: If00263c251d7f5ff3b33bf4fadbfcc4bf53bb0f2
---
A TODO
M src/osmo_ms_driver/__main__.py
M src/osmo_ms_driver/event_server.py
M src/osmo_ms_driver/starter.py
M src/osmo_ms_driver/ul_test.py
5 files changed, 29 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/34/6234/1
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..67238c3
--- /dev/null
+++ b/TODO
@@ -0,0 +1,3 @@
+* Somehow even if it should take 60s.. it takes 120s to start.
+Maybe my math is wrong.. or it is clock drift..
+
diff --git a/src/osmo_ms_driver/__main__.py b/src/osmo_ms_driver/__main__.py
index e6bc45f..aa537f0 100644
--- a/src/osmo_ms_driver/__main__.py
+++ b/src/osmo_ms_driver/__main__.py
@@ -18,7 +18,7 @@
# Local modules
from .event_server import EventServer
from .ul_test import MassUpdateLocationTest
-from .cdf import ease_in_out_duration
+from .cdf import ease_in_out_duration, linear_with_duration
# System modules
import datetime
@@ -28,24 +28,25 @@
# TODO: Parse parameters and test composition. Right now we test
# with a single set of values.
-num_ms = 10
+num_ms = 1000
# How long should starting all apps take
-time_start=datetime.timedelta(seconds=60)
+time_start=datetime.timedelta(seconds=120)
# In which steps to start processes
-time_step=datetime.timedelta(milliseconds=100)
+time_step=datetime.timedelta(milliseconds=50)
# Event server path
-event_server_path="osmo_ms_driver.unix"
+event_server_path="/tmp/osmo_ms_driver.unix"
# The function that decides when to start something
cdf = ease_in_out_duration(time_start, time_step)
+cdf = linear_with_duration(time_start, time_step)
ev_loop = asyncio.get_event_loop()
# Event server to handle MS->test events
ev_server = EventServer("ev_server", event_server_path)
-ev_server.listen(ev_loop)
+asyncio.ensure_future(ev_server.listen(ev_loop))
# Just a single test for now.
test = MassUpdateLocationTest("lu_test", num_ms, cdf, ev_server)
@@ -55,6 +56,6 @@
# Wait for it to complete
ev_loop.run_until_complete(test.complete())
-test.stop_all()
+ev_loop.run_until_complete(test.stop_all())
# TODO: do the analysis
diff --git a/src/osmo_ms_driver/event_server.py b/src/osmo_ms_driver/event_server.py
index 41aa94d..60d526b 100644
--- a/src/osmo_ms_driver/event_server.py
+++ b/src/osmo_ms_driver/event_server.py
@@ -1,22 +1,22 @@
+from osmo_gsm_tester import log
+from functools import partial
+
+import asyncio
import socket
import os
-from osmo_gsm_tester import log
-
-import asyncio
class MSConnection(asyncio.Protocol, log.Origin):
- def __init__(self):
+ def __init__(self, parent):
super().__init__(log.C_RUN, "MSConnection")
def connection_made(self, transport):
# TODO: Update the name once we know the MS.
- pass
+ self._transport = transport
def data_received(self, read):
- # TODO: Update the name once we know the MS.
- pass
+ print("Data...")
class EventServer(log.Origin):
def __init__(self, name, path):
@@ -27,5 +27,6 @@
def register(self, cb):
self._handlers.append(cb)
+ @asyncio.coroutine
def listen(self, loop):
- self._server = loop.create_unix_server(lambda: MSConnection(self), self._path)
+ self._server = yield from loop.create_unix_server(partial(MSConnection, self), self._path)
diff --git a/src/osmo_ms_driver/starter.py b/src/osmo_ms_driver/starter.py
index 28b2cc8..da2774f 100644
--- a/src/osmo_ms_driver/starter.py
+++ b/src/osmo_ms_driver/starter.py
@@ -35,10 +35,11 @@
self._cfg_template = cfg_tmpl
self._options = options
+ @asyncio.coroutine
def start(self, loop):
self.log("Starting mobile and virtphy")
- #process = asyncio.create_subprocess_exec([binary])
- pass
+ self._vphy_proc = yield from asyncio.create_subprocess_exec("sleep", "90")
+ self._omob_proc = yield from asyncio.create_subprocess_exec("sleep", "110")
def kill(self):
"""Clean up things."""
diff --git a/src/osmo_ms_driver/ul_test.py b/src/osmo_ms_driver/ul_test.py
index ebbcb87..ca70670 100644
--- a/src/osmo_ms_driver/ul_test.py
+++ b/src/osmo_ms_driver/ul_test.py
@@ -55,13 +55,17 @@
while len(self._unstarted) > 0:
# Check for timeout
# start pending MS
- while len(self._started) < self._cdf.current_scaled_value():
+ #print(self._cdf.current_value())
+ while len(self._started) < self._cdf.current_scaled_value() and len(self._unstarted) > 0:
+ print("Starting...", len(self._started))
ms = self._unstarted.pop(0)
- ms.start(loop)
+ await ms.start(loop)
self._started.append(ms)
# Progress and sleep
self._cdf.step_once()
+ # The above all took time. So the wall clock and this
+ # time will tick at different speed.
await asyncio.sleep(self._cdf.step_size().total_seconds())
print("All started...")
--
To view, visit https://gerrit.osmocom.org/6234
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If00263c251d7f5ff3b33bf4fadbfcc4bf53bb0f2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>