Skip to content
Snippets Groups Projects
Commit 7a428f64 authored by Arthur T. Glowacki's avatar Arthur T. Glowacki
Browse files

bug fix: Daq would not see files if you don't set have a / at the end of the data-directory

parent f66f599b
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@
import os
import glob
from watchdog.events import FileSystemEventHandler
from dm.common.utility.loggingManager import LoggingManager
......@@ -37,13 +36,17 @@ class DmFileSystemEventHandler(FileSystemEventHandler):
def on_modified(self, event):
FileSystemEventHandler.on_modified(self, event)
self.logger.debug('File system directory modified event: %s' % (event.__dict__))
if event.is_directory:
try:
filePath = max(glob.glob(event.src_path+'*.*'), key=os.path.getctime)
self.logger.debug('File system directory modified event: %s , latest file: %s' % (event.__dict__, filePath))
self.fileSystemObserver.fileUpdated(filePath, self.dataDirectory, self.experiment)
files = glob.glob(event.src_path+'/*.*')
self.logger.debug('File system directory modified event: %s , src path: %s , latest files: %s' % (event.__dict__, event.src_path, files))
if len(files) > 0:
filePath = max(files, key=os.path.getctime)
self.logger.debug('File system directory modified event: %s , latest file: %s' % (event.__dict__, filePath))
self.fileSystemObserver.fileUpdated(filePath, self.dataDirectory, self.experiment)
except:
self.logger.debug('Exception occured when searching for file in directory: %s' % (event.__dict__))
self.logger.error('Exception occured when searching for file in directory: %s' % (event.__dict__))
else:
filePath = event.src_path
self.logger.debug('File system modified event: %s' % (event.__dict__))
......
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