From 5a1548357b1b7d9a3c92825ce67c1db0a00733d2 Mon Sep 17 00:00:00 2001
From: Sinisa Veseli <sveseli@aps.anl.gov>
Date: Sun, 21 Feb 2016 04:37:46 +0000
Subject: [PATCH] added more default keys to upload info; checks for empty file
 paths

---
 src/python/dm/common/objects/uploadInfo.py              | 2 +-
 src/python/dm/common/processing/fileProcessingThread.py | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/python/dm/common/objects/uploadInfo.py b/src/python/dm/common/objects/uploadInfo.py
index 236d1a15..c05337f6 100755
--- a/src/python/dm/common/objects/uploadInfo.py
+++ b/src/python/dm/common/objects/uploadInfo.py
@@ -9,7 +9,7 @@ from dm.common.utility.timeUtility import TimeUtility
 
 class UploadInfo(DmObject):
 
-    DEFAULT_KEY_LIST = [ 'id', 'experimentName', 'dataDirectory', 'status', 'nProcessedFiles', 'nProcessingErrors', 'nFiles', 'percentageComplete', 'startTime', 'endTime', 'runTime', 'startTimestamp', 'endTimestamp' ]
+    DEFAULT_KEY_LIST = [ 'id', 'experimentName', 'dataDirectory', 'status', 'nProcessedFiles', 'nProcessingErrors', 'nCancelledFiles', 'nFiles', 'percentageComplete', 'percentageProcessed', 'percentageProcessingErrors', 'percentageCancelled', 'startTime', 'endTime', 'runTime', 'startTimestamp', 'endTimestamp' ]
 
     def __init__(self, dict={}):
         DmObject.__init__(self, dict)
diff --git a/src/python/dm/common/processing/fileProcessingThread.py b/src/python/dm/common/processing/fileProcessingThread.py
index bc2e485f..25d227ea 100755
--- a/src/python/dm/common/processing/fileProcessingThread.py
+++ b/src/python/dm/common/processing/fileProcessingThread.py
@@ -25,13 +25,16 @@ class FileProcessingThread(threading.Thread):
             return 
 
         filePath = fileInfo.get('filePath')
+        if not filePath:
+            self.logger.warn('Refusing to process empty file path')
+            return
+
         try:
             statusMonitor = fileInfo.get('statusMonitor')
             if statusMonitor and statusMonitor.get('status') == 'aborting':
                 self.logger.debug('File %s processing is cancelled' % (filePath))
                 endProcessingTime = time.time() 
                 statusMonitor.fileProcessingCancelled(filePath, endProcessingTime) 
-                fileInfo.clear()
                 return 
             self.logger.debug('Starting processing file %s' % filePath)
             fileInfo['startProcessingTime'] = time.time() 
@@ -58,7 +61,6 @@ class FileProcessingThread(threading.Thread):
                         endProcessingTime = time.time() 
                         if statusMonitor:
                             statusMonitor.fileProcessed(filePath, endProcessingTime) 
-                        fileInfo.clear()
                 except Exception, ex:
                     self.logger.exception(ex)
                     processingError = '%s processing error: %s' % (processorName, str(ex))
@@ -76,7 +78,6 @@ class FileProcessingThread(threading.Thread):
                         endProcessingTime = time.time() 
                         if statusMonitor:
                             statusMonitor.fileProcessingError(filePath, processingError, endProcessingTime) 
-                        fileInfo.clear()
                         self.logger.debug('No more %s retries left for file %s' % (processorName, filePath))
                     else:
                         retryWaitPeriod = processor.getRetryWaitPeriodInSeconds()
-- 
GitLab