solexa2srf likes to produce output, so my trick of watching the
[htsworkflow.git] / htswcommon / htswcommon / util / queuecommands.py
index 0c342920590079a561130465af81b3eefa8f1a98..78728ae552f43a6172e6b6280c6f72d2442b32e1 100644 (file)
@@ -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)