def get_top_dir(root, path):
"""
Return the directory in path that is a subdirectory of root.
def get_top_dir(root, path):
"""
Return the directory in path that is a subdirectory of root.
logging.error("Couldn't send sequencingFinished")
logging.debug(msg)
def process_IN_DELETE(self, event):
logging.debug("Remove: %s" % os.path.join(event.path, event.name))
logging.error("Couldn't send sequencingFinished")
logging.debug(msg)
def process_IN_DELETE(self, event):
logging.debug("Remove: %s" % os.path.join(event.path, event.name))
def process_IN_UNMOUNT(self, event):
pathname = os.path.join(event.path, event.name)
def process_IN_UNMOUNT(self, event):
pathname = os.path.join(event.path, event.name)
self.cfg['notify_users'] = None
self.cfg['notify_runner'] = None
self.cfg['wait_for_ipar'] = 0
self.cfg['notify_users'] = None
self.cfg['notify_runner'] = None
self.cfg['wait_for_ipar'] = 0
# keep track if the specified mount point is currently mounted
self.mounted_points = {}
# keep track of which mount points tie to which watch directories
# so maybe we can remount them.
self.mounts_to_watches = {}
# keep track if the specified mount point is currently mounted
self.mounted_points = {}
# keep track of which mount points tie to which watch directories
# so maybe we can remount them.
self.mounts_to_watches = {}
self.eventTasks.append(self.process_notify)
def read_config(self, section=None, configfile=None):
super(SpoolWatcher, self).read_config(section, configfile)
self.watchdirs = shlex.split(self._check_required_option('watchdirs'))
self.eventTasks.append(self.process_notify)
def read_config(self, section=None, configfile=None):
super(SpoolWatcher, self).read_config(section, configfile)
self.watchdirs = shlex.split(self._check_required_option('watchdirs'))
self.write_timeout = int(self.cfg['write_timeout'])
self.wait_for_ipar = int(self.cfg['wait_for_ipar'])
self.write_timeout = int(self.cfg['write_timeout'])
self.wait_for_ipar = int(self.cfg['wait_for_ipar'])
def add_watch(self, watchdirs=None):
"""
start watching watchdir or self.watchdir
we're currently limited to watching one directory tree.
"""
def add_watch(self, watchdirs=None):
"""
start watching watchdir or self.watchdir
we're currently limited to watching one directory tree.
"""
+ # create the watch managers if we need them
+ if self.wm is None:
+ self.wm = pyinotify.WatchManager()
+ self.handler = Handler(self.wm, self, self.wait_for_ipar)
+ self.notifier = pyinotify.Notifier(self.wm, self.handler)
+
# the one tree limit is mostly because self.wdd is a single item
# but managing it as a list might be a bit more annoying
if watchdirs is None:
# the one tree limit is mostly because self.wdd is a single item
# but managing it as a list might be a bit more annoying
if watchdirs is None:
# process the queue of events as explained above
self.notifier.process_events()
#check events waits timeout
# process the queue of events as explained above
self.notifier.process_events()
#check events waits timeout
# should we do something?
# has something happened?
for watchdir, last_events in self.handler.last_event.items():
# should we do something?
# has something happened?
for watchdir, last_events in self.handler.last_event.items():
for last_event_dir, last_event_time in last_events.items():
time_delta = time.time() - last_event_time
if time_delta > self.write_timeout:
for last_event_dir, last_event_time in last_events.items():
time_delta = time.time() - last_event_time
if time_delta > self.write_timeout:
super(SpoolWatcher, self).stop()
def startCopy(self, watchdir=None, event_path=None):
logging.debug("writes seem to have stopped")
super(SpoolWatcher, self).stop()
def startCopy(self, watchdir=None, event_path=None):
logging.debug("writes seem to have stopped")
if self.notify_runner is not None:
for r in self.notify_runner:
self.rpc_send(r, tuple(), 'startCopy')
if self.notify_runner is not None:
for r in self.notify_runner:
self.rpc_send(r, tuple(), 'startCopy')