From 623842411394138373c9a585b68157a8ec456d09 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 13 Aug 2012 15:12:54 -0400 Subject: [PATCH] cc-4105: added docs. removed unused method --- python_apps/media-monitor2/media/monitor/airtime.py | 3 --- python_apps/media-monitor2/media/monitor/eventdrainer.py | 4 ++++ python_apps/media-monitor2/media/monitor/manager.py | 9 +++++++++ .../media-monitor2/media/monitor/watchersyncer.py | 1 - python_apps/media-monitor2/tests/test_notifier.py | 5 +---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/airtime.py b/python_apps/media-monitor2/media/monitor/airtime.py index 96147ada5..d3f629402 100644 --- a/python_apps/media-monitor2/media/monitor/airtime.py +++ b/python_apps/media-monitor2/media/monitor/airtime.py @@ -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']) diff --git a/python_apps/media-monitor2/media/monitor/eventdrainer.py b/python_apps/media-monitor2/media/monitor/eventdrainer.py index dbf0c5d89..4fabc339b 100644 --- a/python_apps/media-monitor2/media/monitor/eventdrainer.py +++ b/python_apps/media-monitor2/media/monitor/eventdrainer.py @@ -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) diff --git a/python_apps/media-monitor2/media/monitor/manager.py b/python_apps/media-monitor2/media/monitor/manager.py index db222063e..8d2e8c035 100644 --- a/python_apps/media-monitor2/media/monitor/manager.py +++ b/python_apps/media-monitor2/media/monitor/manager.py @@ -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): diff --git a/python_apps/media-monitor2/media/monitor/watchersyncer.py b/python_apps/media-monitor2/media/monitor/watchersyncer.py index 66fae3310..c0a1b4416 100644 --- a/python_apps/media-monitor2/media/monitor/watchersyncer.py +++ b/python_apps/media-monitor2/media/monitor/watchersyncer.py @@ -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() diff --git a/python_apps/media-monitor2/tests/test_notifier.py b/python_apps/media-monitor2/tests/test_notifier.py index 39866dde9..a42a21e12 100644 --- a/python_apps/media-monitor2/tests/test_notifier.py +++ b/python_apps/media-monitor2/tests/test_notifier.py @@ -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