From: Diane Trout Date: Tue, 30 Sep 2008 23:43:23 +0000 (+0000) Subject: solexa2srf likes to produce output, so my trick of watching the X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=4e829eb172a66a20861c3cf4187dceb83887fb99 solexa2srf likes to produce output, so my trick of watching the sockets to block until when the process ends didn't work. This patch inserts a simple sleep(1) (second) into the code that waits for the jobs to finish to prevent the queue manager from rapidly spinning. It should probably be fixed with a better way of monitoring for when a process finishes MERGED from trunk (the hard way) --- diff --git a/htswcommon/htswcommon/util/queuecommands.py b/htswcommon/htswcommon/util/queuecommands.py index 0c34292..78728ae 100644 --- a/htswcommon/htswcommon/util/queuecommands.py +++ b/htswcommon/htswcommon/util/queuecommands.py @@ -7,6 +7,7 @@ from subprocess import PIPE import subprocess import select import sys +import time class QueueCommands(object): """ @@ -50,6 +51,7 @@ class QueueCommands(object): queue_log.info('using %s as cwd' % (self.cwd,)) while (len(self.to_run) > 0) and self.under_process_limit(): + queue_log.info('%d left to run', len(self.to_run)) cmd = self.to_run.pop(0) p = subprocess.Popen(cmd, stdout=PIPE, cwd=self.cwd, shell=True) self.running[p.stdout] = p @@ -79,6 +81,7 @@ class QueueCommands(object): pending = self.running[pending_fd] # if it really did finish, remove it from running jobs if pending.poll() is not None: - queue_log.info("Process %d finished" % (pending.pid,)) + queue_log.info("Process %d finished [%d]", + pending.pid, pending.returncode) del self.running[pending_fd] - + time.sleep(1)