Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas
This commit is contained in:
commit
e4e97e9c32
1 changed files with 13 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
""" Analyzes and imports an audio file into the Airtime library.
|
""" Analyzes and imports an audio file into the Airtime library.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
import threading
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from metadata_analyzer import MetadataAnalyzer
|
from metadata_analyzer import MetadataAnalyzer
|
||||||
from filemover_analyzer import FileMoverAnalyzer
|
from filemover_analyzer import FileMoverAnalyzer
|
||||||
|
@ -30,10 +31,11 @@ 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.
|
||||||
"""
|
"""
|
||||||
# Might be super critical to initialize a separate log file here so that we
|
# It is super critical to initialize a separate log file here so that we
|
||||||
# don't inherit logging/locks from the parent process. Supposedly
|
# don't inherit logging/locks from the parent process. Supposedly
|
||||||
# this can lead to Bad Things (deadlocks): http://bugs.python.org/issue6721
|
# this can lead to Bad Things (deadlocks): http://bugs.python.org/issue6721
|
||||||
AnalyzerPipeline.setup_logging()
|
AnalyzerPipeline.python_logger_deadlock_workaround()
|
||||||
|
|
||||||
try:
|
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()")
|
||||||
|
@ -64,9 +66,12 @@ class AnalyzerPipeline:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def setup_logging():
|
def python_logger_deadlock_workaround():
|
||||||
_LOG_PATH = "/var/log/airtime/airtime_analyzer_pipeline.log"
|
# Workaround for: http://bugs.python.org/issue6721#msg140215
|
||||||
FORMAT = "%(asctime)s [%(module)s] [%(levelname)-5.5s] %(message)s"
|
logger_names = logging.Logger.manager.loggerDict.keys()
|
||||||
logging.basicConfig(filename=_LOG_PATH,level=logging.DEBUG, format=FORMAT)
|
logger_names.append(None) # Root logger
|
||||||
#rootLogger = logging.getLogger()
|
for name in logger_names:
|
||||||
#rootLogger.setFormatter(logFormatter)
|
for handler in logging.getLogger(name).handlers:
|
||||||
|
handler.createLock()
|
||||||
|
logging._lock = threading.RLock()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue