import sys
import time
import threading
+import subprocess
from benderjab import rpc
return 'StatusReport: Not implemented'
- def sequencingFinished(self, run_dir):
+ def sequencingFinished(self, flowcell):
"""
Sequenceing (and copying) is finished, time to start pipeline
"""
logging.debug("received sequencing finished message")
- self.launchJob(run_dir, flowcell, ci)
+ self.launchJob(flowcell)
return "started"
self.send(u, msg)
- def _runner(self, run_dir, flowcell, conf_info):
+ def _runner(self, flowcell):
# retrieve config step
# example error message
#self.reportMsg("Retrieve config (%s): FAILED" % (run_dir))
+ #stdout_filepath = os.path.join(conf_info.analysis_dir,
+ # "pipeline_configure_stdout.txt")
+ #stderr_filepath = os.path.join(conf_info.analysis_dir,
+ # "pipeline_configure_stderr.txt")
+
+ stdout_filepath = '/tmp/main_pipeline_script_stdout.txt'
+ stderr_filepath = '/tmp/main_pipeline_script_stderr.txt'
+
+ fout = open(stdout_filepath, 'w')
+ ferr = open(stderr_filepath, 'w')
- # configure step
- if status_retrieve_cfg:
- status = configure(conf_info)
- if status:
- logging.info("Runner: Configure: success")
- self.reportMsg("Configure (%s): success" % (run_dir))
- self.reportMsg(
- os.linesep.join(glob(os.path.join(run_dir,'Data','C*')))
- )
- else:
- logging.error("Runner: Configure: failed")
- self.reportMsg("Configure (%s): FAILED" % (run_dir))
+ pipe = subprocess.Popen(['./MainPipelineScript',
+ '%s' % (flowcell)],
+ stdout=fout,
+ stderr=ferr)
+
+ print "Attempting run at: %s" % (time.ctime())
+ error_code = pipe.wait()
+
+ self.reportMsg("Return code is: %s" % (error_code))
+
+ # Clean up
+ fout.close()
+ ferr.close()
- #if successful, continue
- if status:
- # Setup status cmdline status monitor
- #startCmdLineStatusMonitor(ci)
-
- # running step
- print 'Running pipeline now!'
- run_status = run_pipeline(conf_info)
- if run_status is True:
- logging.info('Runner: Pipeline: success')
- self.reportMsg("Pipeline run (%s): Finished" % (run_dir,))
- else:
- logging.info('Runner: Pipeline: failed')
- self.reportMsg("Pipeline run (%s): FAILED" % (run_dir))
-
-
- def launchJob(self, run_dir, flowcell, conf_info):
+
+ def launchJob(self, flowcell):
"""
Starts up a thread for running the pipeline
"""
t = threading.Thread(target=self._runner,
- args=[run_dir, flowcell, conf_info])
+ args=[flowcell])
t.setDaemon(True)
t.start()