Skip to content

Commit

Permalink
Added verbose mode for updated message queue processing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsekar committed Nov 14, 2017
1 parent 10f9a60 commit 723b438
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/test_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def test_update_scheme(self):
queries = [A(id='query1',b=True),A(id='query2',b=True)]
queries[0].x.append(queries[1])
sim = SimulationState()
# This prints out each message when received
sim.verbose = False
sim.add_as_graphquery(queries)

# Test 1
Expand Down
4 changes: 3 additions & 1 deletion wc_rules/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self,**kwargs):
super().__init__(**kwargs)
self.nodetypequery= NodeTypeQuery()
self.update_message_queue = deque()
self.verbose = False

def add_message(self,update_message):
# appends to the right of deque
Expand All @@ -38,7 +39,8 @@ def pop_message(self):

def process_message(self,update_message):
# processes and returns a list of messages
# print('processing message ',update_message.__str__())
if self.verbose:
print('processing message ',update_message.__str__())
update_attr = update_message['update_attr']
update_type = update_message['update_type']
msgs = []
Expand Down

0 comments on commit 723b438

Please sign in to comment.