Skip to content
Snippets Groups Projects
Commit fb7965ac authored by sveseli's avatar sveseli
Browse files

make status monitor calls optional

parent 9150e4a6
No related branches found
No related tags found
No related merge requests found
...@@ -23,8 +23,8 @@ class FileProcessingThread(threading.Thread): ...@@ -23,8 +23,8 @@ class FileProcessingThread(threading.Thread):
def processFile(self, fileInfo): def processFile(self, fileInfo):
filePath = fileInfo.get('filePath') filePath = fileInfo.get('filePath')
try: try:
statusMonitor = fileInfo['statusMonitor'] statusMonitor = fileInfo.get('statusMonitor')
if statusMonitor.get('status') == 'aborting': if statusMonitor and statusMonitor.get('status') == 'aborting':
self.logger.debug('File %s processing is cancelled' % (filePath)) self.logger.debug('File %s processing is cancelled' % (filePath))
endProcessingTime = time.time() endProcessingTime = time.time()
statusMonitor.fileProcessingCancelled(filePath, endProcessingTime) statusMonitor.fileProcessingCancelled(filePath, endProcessingTime)
...@@ -53,7 +53,8 @@ class FileProcessingThread(threading.Thread): ...@@ -53,7 +53,8 @@ class FileProcessingThread(threading.Thread):
if processorNumber == nProcessors: if processorNumber == nProcessors:
self.logger.debug('File %s processing is complete' % (filePath)) self.logger.debug('File %s processing is complete' % (filePath))
endProcessingTime = time.time() endProcessingTime = time.time()
statusMonitor.fileProcessed(filePath, endProcessingTime) if statusMonitor:
statusMonitor.fileProcessed(filePath, endProcessingTime)
fileInfo.clear() fileInfo.clear()
except Exception, ex: except Exception, ex:
self.logger.exception(ex) self.logger.exception(ex)
...@@ -70,7 +71,8 @@ class FileProcessingThread(threading.Thread): ...@@ -70,7 +71,8 @@ class FileProcessingThread(threading.Thread):
processorDict['numberOfRetriesLeft'] = nRetriesLeft - 1 processorDict['numberOfRetriesLeft'] = nRetriesLeft - 1
if nRetriesLeft <= 0: if nRetriesLeft <= 0:
endProcessingTime = time.time() endProcessingTime = time.time()
statusMonitor.fileProcessingError(filePath, processingError, endProcessingTime) if statusMonitor:
statusMonitor.fileProcessingError(filePath, processingError, endProcessingTime)
fileInfo.clear() fileInfo.clear()
self.logger.debug('No more %s retries left for file %s' % (processorName, filePath)) self.logger.debug('No more %s retries left for file %s' % (processorName, filePath))
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment