CC-5709: Airtime Analyzer

* Log tracebacks from child process
This commit is contained in:
Albert Santoni 2014-04-16 13:05:02 -04:00
parent 4d1843ca1f
commit b0670f5f47
1 changed files with 28 additions and 22 deletions

View File

@ -30,6 +30,7 @@ class AnalyzerPipeline:
temporary randomly generated name, which is why we want temporary randomly generated name, which is why we want
to know what the original name was. to know what the original name was.
""" """
try:
if not isinstance(queue, multiprocessing.queues.Queue): if not isinstance(queue, multiprocessing.queues.Queue):
raise TypeError("queue must be a multiprocessing.Queue()") raise TypeError("queue must be a multiprocessing.Queue()")
if not isinstance(audio_file_path, unicode): if not isinstance(audio_file_path, unicode):
@ -39,6 +40,7 @@ class AnalyzerPipeline:
if not isinstance(original_filename, unicode): if not isinstance(original_filename, unicode):
raise TypeError("original_filename must be unicode. Was of type " + type(original_filename).__name__ + " instead.") raise TypeError("original_filename must be unicode. Was of type " + type(original_filename).__name__ + " instead.")
# Analyze the audio file we were told to analyze: # Analyze the audio file we were told to analyze:
# First, we extract the ID3 tags and other metadata: # First, we extract the ID3 tags and other metadata:
metadata = dict() metadata = dict()
@ -52,5 +54,9 @@ class AnalyzerPipeline:
# Pass all the file metadata back to the main analyzer process, which then passes # Pass all the file metadata back to the main analyzer process, which then passes
# it back to the Airtime web application. # it back to the Airtime web application.
queue.put(metadata) queue.put(metadata)
except Exception as e:
# Ensures the traceback for this child process gets written to our log files:
logging.exception(e)
raise e