Skip to content

Commit

Permalink
removed print statements, fixed code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
r3w0p committed Nov 19, 2019
1 parent 5088b22 commit 4232abb
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 25 deletions.
10 changes: 2 additions & 8 deletions bobocep/decider/bobo_decider.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from bobocep.rules.events.action_event import ActionEvent
from bobocep.rules.events.bobo_event import BoboEvent
from bobocep.rules.events.composite_event import CompositeEvent
from bobocep.rules.events.histories.bobo_history import BoboHistory
from bobocep.setup.distributed.incoming.dist_incoming_subscriber import \
IDistIncomingSubscriber
from bobocep.setup.task.bobo_task import BoboTask
Expand Down Expand Up @@ -52,8 +51,8 @@ def _loop(self) -> None:
for nfa_handler in self._nfa_handlers.values():
nfa_handler.process(event)

except Exception as e:
print("{}: {}".format("DECIDER", str(e)))
except Exception:
pass

def add_nfa_handler(self, nfa_handler: BoboNFAHandler) -> None:
"""
Expand Down Expand Up @@ -122,9 +121,6 @@ def on_handler_final(self,
event: CompositeEvent):
# notify producer on a new complex event being identified
with self._lock:

print("{}: {}, {}".format("on_handler_final", nfa_name, run_id))

if nfa_name in self._nfa_handlers:
if self._recursive:
self._nfa_handlers[nfa_name].add_recent(event)
Expand Down Expand Up @@ -229,8 +225,6 @@ def on_dist_run_final(self,
run_id: str,
event: CompositeEvent) -> None:
with self._lock:
print("{}: {}, {}".format("on_dist_run_final", nfa_name, run_id))

handler = self._nfa_handlers.get(nfa_name)

if handler is None:
Expand Down
2 changes: 1 addition & 1 deletion bobocep/producer/action_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ def __init__(self,
def _handle_producer_event(self, event: CompositeEvent) -> bool:
try:
return self._action.execute(event).success
except Exception as e:
except Exception:
return False
4 changes: 2 additions & 2 deletions bobocep/producer/bobo_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def _loop(self) -> None:
for subscriber in self._subs[event.name]:
subscriber.on_rejected_producer_event(event)

except Exception as e:
print("{}: {}".format("PRODUCER", str(e)))
except Exception:
pass

@abstractmethod
def _handle_producer_event(self, event: CompositeEvent) -> bool:
Expand Down
12 changes: 5 additions & 7 deletions bobocep/setup/distributed/incoming/bobo_dist_incoming.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from threading import Thread

from pika import ConnectionParameters, BlockingConnection, BasicProperties

import bobocep.setup.distributed.bobo_dist_constants as bdc
Expand Down Expand Up @@ -123,16 +124,13 @@ def _callback_handle(self, ch, method, properties, body):
elif method.routing_key == bdc.ACTION:
self._handle_action(body)

except Exception as e:
print("{}: {}".format("_callback_handle", str(e)))
except Exception:
pass

def _callback(self, ch, method, properties, body):
if properties.message_id == self.user_id:
return

print("{}: {} ({})".format("INCOMING", method.routing_key,
self.outgoing.is_synced()))

try:
if self.outgoing.is_synced():
if method.routing_key == bdc.SYNC_REQ:
Expand All @@ -146,8 +144,8 @@ def _callback(self, ch, method, properties, body):
if method.routing_key == bdc.SYNC_RES:
self._handle_sync_response(ch, method, properties, body)

except Exception as e:
print("{}: {}".format("_callback", str(e)))
except Exception:
pass

def _handle_transition(self, data: str) -> None:
json_data = json.loads(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from bobocep.rules.events.action_event import ActionEvent
from bobocep.rules.events.bobo_event import BoboEvent
from bobocep.rules.events.histories.bobo_history import BoboHistory
from bobocep.rules.events.composite_event import CompositeEvent


Expand Down
6 changes: 2 additions & 4 deletions bobocep/setup/distributed/outgoing/bobo_dist_outgoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def _loop(self) -> None:
self._send_events(self._queue_final, bdc.FINAL)
self._send_events(self._queue_action, bdc.ACTION)

except Exception as e:
print("{}: {}".format("", str(e)))
except Exception:
pass

def _cancel(self):
self._is_synced = False
Expand Down Expand Up @@ -198,8 +198,6 @@ def _send_events(self, queue: Queue, routing_key: str):
body=data_json
)

print("{}: {}".format("OUTGOING", routing_key))

def on_handler_transition(self,
nfa_name: str,
run_id: str,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bobocep/test_setup/test_bobo_setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest
from time import sleep

from pika import ConnectionParameters, PlainCredentials

from bobocep.decider.decider_subscriber import IDeciderSubscriber
from bobocep.forwarder.forwarder_subscriber import IForwarderSubscriber
from bobocep.producer.producer_subscriber import IProducerSubscriber
Expand All @@ -22,8 +24,6 @@
from bobocep.setup.bobo_complex_event import BoboComplexEvent
from bobocep.setup.bobo_setup import BoboSetup

from pika import ConnectionParameters, PlainCredentials

EXCHANGE_NAME = "test_exchange_name"
USER_NAME = "test_user_name"

Expand Down

0 comments on commit 4232abb

Please sign in to comment.