From 7912d8508fb3b59c8de81c508be629cd1a9016aa Mon Sep 17 00:00:00 2001 From: Sean McCann Date: Mon, 22 Apr 2024 17:18:38 +1200 Subject: [PATCH] watching thread counts during datamanager test. added print statement to watch for responses. --- QGIS-AIMS-Plugin/AIMSDataManager/DataManager.py | 2 +- QGIS-AIMS-Plugin/test/DataManager_Test.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/QGIS-AIMS-Plugin/AIMSDataManager/DataManager.py b/QGIS-AIMS-Plugin/AIMSDataManager/DataManager.py index e454e74..23a8f26 100644 --- a/QGIS-AIMS-Plugin/AIMSDataManager/DataManager.py +++ b/QGIS-AIMS-Plugin/AIMSDataManager/DataManager.py @@ -244,7 +244,7 @@ def response(self,etft=FeedRef((FeatureType.ADDRESS,FeedType.RESOLUTIONFEED))): resp = () delflag = False #while self.ioq.get((et,ft)) and not self.ioq[(et,ft)]['resp'].empty(): - print(f'DataManager.Response -- ETFT: {etft} -- Result Queue Length: {self.ioq[etft]["resp"]} -- ') + print(f'DataManager.Response -- ETFT: {etft} -- Result Queue Length: ~{self.ioq[etft]["resp"].qsize()} -- ') #TODO:Delete while etft in FEEDS.values() and not self.ioq[etft]['resp'].empty(): resp += (self.ioq[etft]['resp'].get(),) print(f'Response: {resp}') diff --git a/QGIS-AIMS-Plugin/test/DataManager_Test.py b/QGIS-AIMS-Plugin/test/DataManager_Test.py index f6ef8cd..3f9cdfd 100644 --- a/QGIS-AIMS-Plugin/test/DataManager_Test.py +++ b/QGIS-AIMS-Plugin/test/DataManager_Test.py @@ -24,6 +24,7 @@ import string import time import os +import threading ROOT = os.path.join(os.path.dirname(os.path.dirname(__file__))) sys.path.append(os.path.join(ROOT, 'AIMSDataManager')) @@ -202,7 +203,9 @@ class Test_5_DataManagerChangeFeed(unittest.TestCase): ver = 1000000 def setUp(self): + for t in threading.enumerate(): print(f'THREAD INFO 0: {t}') self.dm = self.initDM() + for t in threading.enumerate(): print(f'THREAD INFO 1: {t}') self.af = FeedRef((FeatureType.ADDRESS,FeedType.FEATURES)) self.ac = FeedRef((FeatureType.ADDRESS,FeedType.CHANGEFEED)) self.ar = FeedRef((FeatureType.ADDRESS,FeedType.RESOLUTIONFEED)) @@ -219,7 +222,13 @@ def initDM(self) -> DataManager: return dm def tearDown(self): + print('\nTHREAD CLEANUP - PRE') + for t in threading.enumerate(): print(f'PRE: {t}') + print('===============================') self.dm.close() + for t in threading.enumerate(): print(f'POST 0: {t}') + print('===============================') + print('THREAD CLEANUP - POST\n') del self.addr_f def test10_cast(self): @@ -231,6 +240,7 @@ def test20_add(self): addr_c.setVersion(self.ver) self.dm.addAddress(addr_c) resp = None + for t in threading.enumerate(): print(f'THREAD INFO 2: {t}') while not resp: resp = self.dm.response(self.ac) print(f'Waiting for Response to be valid: {resp}') @@ -244,6 +254,7 @@ def test30_update(self): addr_c.setVersion(self.ver) self.dm.updateAddress(addr_c) resp = None + for t in threading.enumerate(): print(f'THREAD INFO 3: {t}') while not resp: resp = self.dm.response(self.ac) for r in resp: @@ -255,6 +266,7 @@ def test40_retire(self): addr_c.setVersion(self.ver) self.dm.retireAddress(addr_c) resp = None + for t in threading.enumerate(): print(f'THREAD INFO 4: {t}') while not resp: resp = self.dm.response(self.ac) for r in resp: