Skip to content

Commit 218b72e

Browse files
committed
refactor: merge _stop into stop, add thread_start helper
- Merge _stop() into stop() in ModuleBase (removes unnecessary indirection) - Update all callers of _stop() to use stop() directly - Add thread_start() convenience function that creates + starts a ModuleThread
1 parent a1586f3 commit 218b72e

7 files changed

Lines changed: 190 additions & 146 deletions

File tree

dimos/core/module.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ def start(self) -> None:
126126

127127
@rpc
128128
def stop(self) -> None:
129-
self._stop()
130-
131-
def _stop(self) -> None:
132129
with self.mod_state as state:
133130
if state == "stopped":
134131
return

dimos/core/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_classmethods() -> None:
8989
)
9090
assert hasattr(class_rpcs["start"], "__rpc__"), "start should have __rpc__ attribute"
9191

92-
nav._stop()
92+
nav.stop()
9393

9494

9595
@pytest.mark.slow

dimos/perception/detection/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def moment_provider(**kwargs) -> Moment2D:
221221
yield moment_provider
222222

223223
moment_provider.cache_clear()
224-
module._stop()
224+
module.stop()
225225

226226

227227
@pytest.fixture(scope="session")
@@ -256,7 +256,7 @@ def moment_provider(**kwargs) -> Moment3D:
256256
yield moment_provider
257257
moment_provider.cache_clear()
258258
if module is not None:
259-
module._stop()
259+
module.stop()
260260

261261

262262
@pytest.fixture(scope="session")
@@ -290,9 +290,9 @@ def object_db_module(get_moment):
290290

291291
yield moduleDB
292292

293-
module2d._stop()
294-
module3d._stop()
295-
moduleDB._stop()
293+
module2d.stop()
294+
module3d.stop()
295+
moduleDB.stop()
296296

297297

298298
@pytest.fixture(scope="session")

dimos/perception/detection/reid/test_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ def test_reid_ingress(imageDetections2d) -> None:
4040
print("Processing detections through ReidModule...")
4141
reid_module.annotations._transport = LCMTransport("/annotations", ImageAnnotations)
4242
reid_module.ingress(imageDetections2d)
43-
reid_module._stop()
43+
reid_module.stop()
4444
print("✓ ReidModule ingress test completed successfully")

0 commit comments

Comments
 (0)