From c29143948343a925428b3594d2169eca3f09843f Mon Sep 17 00:00:00 2001 From: drigato Date: Wed, 7 May 2014 15:01:31 -0400 Subject: [PATCH 1/2] Adding back analyzer deadlock workaround. Removing command to delete empty sub folders inside organize. --- .../application/modules/rest/controllers/MediaController.php | 4 ++-- .../airtime_analyzer/airtime_analyzer/analyzer_pipeline.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index 34bd5ac55..d2a55d0eb 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -252,8 +252,8 @@ class Rest_MediaController extends Zend_Rest_Controller $file->setDbMtime($now); $file->save(); - $this->removeEmptySubFolders( - isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."/srv/airtime/stor/organize/" : "/srv/airtime/stor/organize/"); + /* $this->removeEmptySubFolders( + isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."/srv/airtime/stor/organize/" : "/srv/airtime/stor/organize/"); */ $this->getResponse() ->setHttpResponseCode(200) diff --git a/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py b/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py index 939a4f2d5..39c558bac 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/analyzer_pipeline.py @@ -34,7 +34,7 @@ class AnalyzerPipeline: # It is super critical to initialize a separate log file here so that we # don't inherit logging/locks from the parent process. Supposedly # this can lead to Bad Things (deadlocks): http://bugs.python.org/issue6721 - #AnalyzerPipeline.python_logger_deadlock_workaround() + AnalyzerPipeline.python_logger_deadlock_workaround() try: if not isinstance(queue, multiprocessing.queues.Queue): From 0040965222388ab98892ed3ee3fa748aacac1522 Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 8 May 2014 13:01:49 -0400 Subject: [PATCH 2/2] CC-5840: Add Media -> Endless retries if there is a validation error Fixed by not adding message to retry queue if request returns a validation specific error code (422) --- .../modules/rest/controllers/MediaController.php | 2 +- .../airtime_analyzer/status_reporter.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index d2a55d0eb..8a578fc0c 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -369,7 +369,7 @@ class Rest_MediaController extends Zend_Rest_Controller private function invalidDataResponse() { $resp = $this->getResponse(); - $resp->setHttpResponseCode(400); + $resp->setHttpResponseCode(422); $resp->appendBody("ERROR: Invalid data"); } diff --git a/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py b/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py index 0e3c71619..0a69461ba 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py @@ -91,9 +91,13 @@ def send_http_request(picklable_request, retry_queue): r.raise_for_status() # Raise an exception if there was an http error code returned logging.info("HTTP request sent successfully.") except requests.exceptions.RequestException as e: - # If the web server is having problems, retry the request later: - logging.error("HTTP request failed. Retrying later! Exception was: %s" % str(e)) - retry_queue.append(picklable_request) + if r.status_code != 422: + # If the web server is having problems, retry the request later: + logging.error("HTTP request failed. Retrying later! Exception was: %s" % str(e)) + retry_queue.append(picklable_request) + else: + # Do no retry the request if there was a metadata validation error + logging.error("HTTP request failed. Exception was: %s" % str(e)) except Exception as e: logging.error("HTTP request failed with unhandled exception. %s" % str(e)) # Don't put the request into the retry queue, just give up on this one.