cc-4105: added docs. removed unused method

This commit is contained in:
Rudi Grinberg 2012-08-13 15:12:54 -04:00
parent 12a5edfd5c
commit 6238424113
5 changed files with 14 additions and 8 deletions

View File

@ -112,9 +112,6 @@ class AirtimeMessageReceiver(Loggable):
self.logger.error( traceback.format_exc() )
raise DirectoryIsNotListed(directory)
def supported_messages(self):
return self.dispatch_table.keys()
def md_update(self, msg):
self.logger.info("Updating metadata for: '%s'" %
msg['MDATA_KEY_FILEPATH'])

View File

@ -3,6 +3,10 @@ from media.monitor.log import Loggable
from media.monitor.toucher import RepeatTimer
class EventDrainer(Loggable):
"""
Flushes events from RabbitMQ that are sent from airtime every
certain amount of time
"""
def __init__(self, connection, interval=1):
def cb():
try: connection.drain_events(timeout=0.3)

View File

@ -94,14 +94,23 @@ class Manager(Loggable):
recorded_path=recorded_path)
def get_problem_files_path(self):
"""
returns the path where problem files should go
"""
return self.organize['problem_files_path']
def set_problem_files_path(self, new_path):
"""
Set the path where problem files should go
"""
self.organize['problem_files_path'] = new_path
self.organize['problem_handler'] = \
ProblemFileHandler( PathChannel(signal='badfile',path=new_path) )
def get_recorded_path(self):
"""
returns the path of the recorded directory
"""
return self.organize['recorded_path']
def set_recorded_path(self, new_path):

View File

@ -102,7 +102,6 @@ class TimeoutWatcher(threading.Thread,Loggable):
class WatchSyncer(ReportHandler,Loggable):
def __init__(self, signal, chunking_number = 100, timeout=15):
#self.signal = signal
self.timeout = float(timeout)
self.chunking_number = int(chunking_number)
self.__reset_queue()

View File

@ -16,12 +16,9 @@ class TestReceiver(unittest.TestCase):
cfg = {}
self.amr = AirtimeMessageReceiver(cfg, Manager())
def test_supported_messages(self):
self.assertTrue( len(self.amr.supported_messages()) > 0 )
def test_supported(self):
# Every supported message should fire something
for event_type in self.amr.supported_messages():
for event_type in self.amr.dispatch_tables.keys():
msg = { 'event_type' : event_type, 'extra_param' : 123 }
filtered = filter_ev(msg)
# There should be a better way to test the following without