Skip to content

Commit

Permalink
watching thread counts during datamanager test. added print statement…
Browse files Browse the repository at this point in the history
… to watch for responses.
  • Loading branch information
Sean-McCann-HG committed Apr 22, 2024
1 parent 9ea627d commit 7912d85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion QGIS-AIMS-Plugin/AIMSDataManager/DataManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down
12 changes: 12 additions & 0 deletions QGIS-AIMS-Plugin/test/DataManager_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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))
Expand All @@ -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):
Expand All @@ -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}')
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 7912d85

Please sign in to comment.