complete = "(completed)"
else:
complete = ""
- return u"<WatchEvent: %s %s %s>" % (time.ctime(self.time), self.event_root, complete)
+ return "<WatchEvent: %s %s %s>" % (time.ctime(self.time), self.event_root, complete)
class Handler(pyinotify.ProcessEvent):
def __init__(self, watchmanager, bot, completion_files=None):
# if we've already seen an event in this directory (AKA runfolder)
# keep track if its already hit the "completed" flag
- if watch_path_events.has_key(target):
+ if target in watch_path_events:
run_already_complete = watch_path_events[target].complete
watch_path_events[target] = WatcherEvent(target)
mounts.append(w)
self.mounts_to_watches[mount_location] = mounts
- self.log.info(u"Watching:"+unicode(w))
+ self.log.info("Watching:"+str(w))
self.wdds.append(self.wm.add_watch(w, mask, rec=True, auto_add=True))
def unmount_watch(self, event_path):
# the list getting shorter
for i in range(len(self.wdds),0, -1):
wdd = self.wdds[i]
- self.log.info(u'unmounting: '+unicode(wdd.items()))
- self.wm.rm_watch(wdd.values())
+ self.log.info('unmounting: '+str(list(wdd.items())))
+ self.wm.rm_watch(list(wdd.values()))
del self.wdds[i]
self.mounted = False
self.notifier.read_events()
# should we do something?
# has something happened?
- for watchdir, last_events in self.handler.last_event.items():
- for last_event_dir, last_event_detail in last_events.items():
+ for watchdir, last_events in list(self.handler.last_event.items()):
+ for last_event_dir, last_event_detail in list(last_events.items()):
time_delta = time.time() - last_event_detail.time
if time_delta > self.write_timeout:
- LOGGER.info("timeout: %s" % (unicode(last_event_detail),))
+ LOGGER.info("timeout: %s" % (str(last_event_detail),))
copy_url = self.make_copy_url(watchdir, last_event_dir)
self.startCopy(copy_url)
if last_event_detail.complete:
self.handler.last_event[watchdir] = {}
# handle unmounted filesystems
- for mount_point, was_mounted in self.mounted_points.items():
+ for mount_point, was_mounted in list(self.mounted_points.items()):
if not was_mounted and mount.is_mounted(mount_point):
# we've been remounted. Huzzah!
# restart the watch
"""
Parse xmpp chat messages
"""
- help = u"I can send [copy] message, or squencer [finished]"
- if re.match(u"help", msg):
+ help = "I can send [copy] message, or squencer [finished]"
+ if re.match("help", msg):
reply = help
elif re.match("copy", msg):
self.startCopy(msg)
- reply = u"sent copy message"
- elif re.match(u"finished", msg):
+ reply = "sent copy message"
+ elif re.match("finished", msg):
words = msg.split()
if len(words) == 2:
self.sequencingFinished(words[1])
- reply = u"sending sequencing finished for %s" % (words[1])
+ reply = "sending sequencing finished for %s" % (words[1])
else:
- reply = u"need runfolder name"
+ reply = "need runfolder name"
else:
- reply = u"I didn't understand '%s'" %(msg)
+ reply = "I didn't understand '%s'" %(msg)
return reply
def run(self):