projects
/
htsworkflow.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f09a2d3
)
Update spoolwatcher to 0.2 benderjab's logging api
author
Diane Trout
<diane@caltech.edu>
Wed, 9 Mar 2011 00:14:59 +0000
(16:14 -0800)
committer
Diane Trout
<diane@caltech.edu>
Wed, 9 Mar 2011 00:14:59 +0000
(16:14 -0800)
htsworkflow/automation/spoolwatcher.py
patch
|
blob
|
history
diff --git
a/htsworkflow/automation/spoolwatcher.py
b/htsworkflow/automation/spoolwatcher.py
index 932efbf41ca9045656015962e4f2e3593e2812c2..af5932e8711d81c51ba3d5eb444eae4884a4d0a6 100644
(file)
--- a/
htsworkflow/automation/spoolwatcher.py
+++ b/
htsworkflow/automation/spoolwatcher.py
@@
-17,7
+17,6
@@
IN_UNMOUNT = EventsCodes.ALL_FLAGS['IN_UNMOUNT']
from benderjab import rpc
from benderjab import rpc
-
class WatcherEvent(object):
"""
Track information about a file event
class WatcherEvent(object):
"""
Track information about a file event
@@
-44,6
+43,7
@@
class Handler(pyinotify.ProcessEvent):
self.last_event = {}
self.watchmanager = watchmanager
self.bot = bot
self.last_event = {}
self.watchmanager = watchmanager
self.bot = bot
+ self.log = bot.log
if completion_files is not None:
completion_files = [ x.lower() for x in completion_files ]
self.completion_files = completion_files
if completion_files is not None:
completion_files = [ x.lower() for x in completion_files ]
self.completion_files = completion_files
@@
-62,7
+62,7
@@
class Handler(pyinotify.ProcessEvent):
runfolder = os.path.join(watch_path, target)
if not is_runfolder(target):
runfolder = os.path.join(watch_path, target)
if not is_runfolder(target):
-
loggin
g.debug("Skipping %s, not a runfolder" % (target,))
+
self.lo
g.debug("Skipping %s, not a runfolder" % (target,))
continue
# grab the previous events for this watch path
continue
# grab the previous events for this watch path
@@
-88,15
+88,15
@@
class Handler(pyinotify.ProcessEvent):
self.last_event[watch_path][target].complete = True
msg += "(completed)"
self.last_event[watch_path][target].complete = True
msg += "(completed)"
-
loggin
g.debug(msg)
+
self.lo
g.debug(msg)
def process_IN_DELETE(self, event):
def process_IN_DELETE(self, event):
-
loggin
g.debug("Remove: %s" % os.path.join(event.path, event.name))
+
self.lo
g.debug("Remove: %s" % os.path.join(event.path, event.name))
pass
def process_IN_UNMOUNT(self, event):
pathname = os.path.join(event.path, event.name)
pass
def process_IN_UNMOUNT(self, event):
pathname = os.path.join(event.path, event.name)
-
loggin
g.debug("IN_UNMOUNT: %s" % (pathname,))
+
self.lo
g.debug("IN_UNMOUNT: %s" % (pathname,))
self.bot.unmount_watch(event.path)
class SpoolWatcher(rpc.XmlRpcBot):
self.bot.unmount_watch(event.path)
class SpoolWatcher(rpc.XmlRpcBot):
@@
-203,7
+203,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
mounts.append(w)
self.mounts_to_watches[mount_location] = mounts
mounts.append(w)
self.mounts_to_watches[mount_location] = mounts
-
loggin
g.info(u"Watching:"+unicode(w))
+
self.lo
g.info(u"Watching:"+unicode(w))
self.wdds.append(self.wm.add_watch(w, mask, rec=True, auto_add=True))
def unmount_watch(self, event_path):
self.wdds.append(self.wm.add_watch(w, mask, rec=True, auto_add=True))
def unmount_watch(self, event_path):
@@
-211,7
+211,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
# the list getting shorter
for i in range(len(self.wdds),0, -1):
wdd = self.wdds[i]
# the list getting shorter
for i in range(len(self.wdds),0, -1):
wdd = self.wdds[i]
-
loggin
g.info(u'unmounting: '+unicode(wdd.items()))
+
self.lo
g.info(u'unmounting: '+unicode(wdd.items()))
self.wm.rm_watch(wdd.values())
del self.wdds[i]
self.mounted = False
self.wm.rm_watch(wdd.values())
del self.wdds[i]
self.mounted = False
@@
-221,7
+221,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
if root_copy_url[-1] != '/':
root_copy_url += '/'
copy_url = root_copy_url + list_event_dir
if root_copy_url[-1] != '/':
root_copy_url += '/'
copy_url = root_copy_url + list_event_dir
-
loggin
g.debug('Copy url: %s' % (copy_url,))
+
self.lo
g.debug('Copy url: %s' % (copy_url,))
return copy_url
def process_notify(self, *args):
return copy_url
def process_notify(self, *args):
@@
-254,7
+254,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
# restart the watch
for watch in self.mounts_to_watches[mount_point]:
self.add_watch(watch)
# restart the watch
for watch in self.mounts_to_watches[mount_point]:
self.add_watch(watch)
-
loggin
g.info(
+
self.log
g.info(
"%s was remounted, restarting watch" % \
(mount_point)
)
"%s was remounted, restarting watch" % \
(mount_point)
)
@@
-301,7
+301,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
super(SpoolWatcher, self).stop()
def startCopy(self, copy_url=None):
super(SpoolWatcher, self).stop()
def startCopy(self, copy_url=None):
-
loggin
g.debug("writes seem to have stopped")
+
self.lo
g.debug("writes seem to have stopped")
if self.notify_runner is not None:
for r in self.notify_runner:
self.rpc_send(r, tuple([copy_url]), 'startCopy')
if self.notify_runner is not None:
for r in self.notify_runner:
self.rpc_send(r, tuple([copy_url]), 'startCopy')
@@
-311,7
+311,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
def sequencingFinished(self, run_dir):
# need to strip off self.watchdirs from rundir I suspect.
def sequencingFinished(self, run_dir):
# need to strip off self.watchdirs from rundir I suspect.
-
loggin
g.info("run.completed in " + str(run_dir))
+
self.lo
g.info("run.completed in " + str(run_dir))
for watch in self.watchdirs:
if not run_dir.startswith(watch):
print "%s didn't start with %s" % (run_dir, watch)
for watch in self.watchdirs:
if not run_dir.startswith(watch):
print "%s didn't start with %s" % (run_dir, watch)
@@
-322,7
+322,7
@@
class SpoolWatcher(rpc.XmlRpcBot):
else:
stripped_run_dir = run_dir
else:
stripped_run_dir = run_dir
-
loggin
g.debug("stripped to " + stripped_run_dir)
+
self.lo
g.debug("stripped to " + stripped_run_dir)
if self.notify_users is not None:
for u in self.notify_users:
self.send(u, 'Sequencing run %s finished' % \
if self.notify_users is not None:
for u in self.notify_users:
self.send(u, 'Sequencing run %s finished' % \