8 from benderjab import rpc
10 class Runner(rpc.XmlRpcBot):
12 Manage running pipeline jobs.
14 def __init__(self, section=None, configfile=None):
15 #if configfile is None:
16 # self.configfile = "~/.gaworkflow"
17 super(Runner, self).__init__(section, configfile)
19 self.cfg['notify_users'] = None
21 self.register_function(self.sequencingFinished)
22 self.eventTasks.append(self.update)
24 def read_config(self, section=None, configfile=None):
25 super(Runner, self).read_config(section, configfile)
27 def _parser(self, msg, who):
29 Parse xmpp chat messages
31 help = u"I can send [start] a run, or report [status]"
32 if re.match(u"help", msg):
34 elif re.match("status", msg):
35 reply = u"not implemented"
36 elif re.match(u"start", msg):
39 self.sequencingFinished(words[1])
40 reply = u"starting run for %s" % (words[1])
42 reply = u"need runfolder name"
44 reply = u"I didn't understand '%s'" %(msg)
47 def start(self, daemonize):
51 super(Runner, self).start(daemonize)
57 super(Runner, self).stop()
59 def sequencingFinished(self, run_dir):
61 Sequenceing (and copying) is finished, time to start pipeline
63 logging.debug("received sequencing finished message")
65 def pipelineFinished(self, run_dir):
66 # need to strip off self.watch_dir from rundir I suspect.
67 logging.info("pipeline finished in" + str(run_dir))
68 #pattern = self.watch_dir
69 #if pattern[-1] != os.path.sep:
70 # pattern += os.path.sep
71 #stripped_run_dir = re.sub(pattern, "", run_dir)
72 #logging.debug("stripped to " + stripped_run_dir)
73 #if self.notify_users is not None:
74 # for u in self.notify_users:
75 # self.send(u, 'Sequencing run %s finished' % #(stripped_run_dir))
76 #if self.notify_runner is not None:
77 # for r in self.notify_runner:
78 # self.rpc_send(r, (stripped_run_dir,), 'sequencingFinished')
84 if __name__ == "__main__":
85 sys.exit(main(sys.argv[1:]))