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

Update daq file watchdog to handle rsync directory modified events

parent 036ab4d2
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import os
import glob
from watchdog.events import FileSystemEventHandler
......@@ -20,18 +21,29 @@ class DmFileSystemEventHandler(FileSystemEventHandler):
def on_any_event(self, event):
FileSystemEventHandler.on_any_event(self, event)
self.logger.debug('File system any_event event: %s' % (event.__dict__))
def on_created(self, event):
FileSystemEventHandler.on_created(self, event)
self.logger.debug('File system created event: %s' % (event.__dict__))
def on_moved(self, event):
FileSystemEventHandler.on_moved(self, event)
self.logger.debug('File system moved event: %s' % (event.__dict__))
def on_deleted(self, event):
FileSystemEventHandler.on_deleted(self, event)
self.logger.debug('File system deleted event: %s' % (event.__dict__))
def on_modified(self, event):
FileSystemEventHandler.on_modified(self, event)
filePath = event.src_path
self.logger.debug('File system modified event: %s' % (event.__dict__))
if not event.is_directory:
if event.is_directory:
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)
else:
filePath = event.src_path
self.logger.debug('File system modified event: %s' % (event.__dict__))
self.fileSystemObserver.fileUpdated(filePath, self.dataDirectory, self.experiment)
def on_moved(self, event):
......
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