commit/galaxy-central: natefoo: In the local job runner, use NamedTemporaryFiles rather than subprocess.PIPEs to prevent Popen from hanging when a lot of data is written to STDOUT/STDERR. Fixes #662.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/32ab8f1d950d/ changeset: 32ab8f1d950d user: natefoo date: 2012-01-23 22:17:29 summary: In the local job runner, use NamedTemporaryFiles rather than subprocess.PIPEs to prevent Popen from hanging when a lot of data is written to STDOUT/STDERR. Fixes #662. affected #: 1 file diff -r f5d9da22df64d315953a28d7a20429b1a3d5d73c -r 32ab8f1d950d02bf2c9dfbe46d76776e0604ff6e lib/galaxy/jobs/runners/local.py --- a/lib/galaxy/jobs/runners/local.py +++ b/lib/galaxy/jobs/runners/local.py @@ -1,5 +1,6 @@ import logging import subprocess +import tempfile from Queue import Queue import threading @@ -65,11 +66,13 @@ if command_line: try: log.debug( 'executing: %s' % command_line ) + stdout_file = tempfile.NamedTemporaryFile( suffix='_stdout', dir=job_wrapper.working_directory ) + stderr_file = tempfile.NamedTemporaryFile( suffix='_stderr', dir=job_wrapper.working_directory ) proc = subprocess.Popen( args = command_line, shell = True, cwd = job_wrapper.working_directory, - stdout = subprocess.PIPE, - stderr = subprocess.PIPE, + stdout = stdout_file, + stderr = stderr_file, env = os.environ, preexec_fn = os.setpgrp ) job_wrapper.set_runner( 'local:///', proc.pid ) @@ -96,9 +99,13 @@ if sleep_time < 8: # So we don't stat every second sleep_time *= 2 - stdout = proc.stdout.read( 32768 ) - stderr = proc.stderr.read( 32768 ) proc.wait() # reap + stdout_file.seek( 0 ) + stderr_file.seek( 0 ) + stdout = stdout_file.read( 32768 ) + stderr = stderr_file.read( 32768 ) + stdout_file.close() + stderr_file.close() log.debug('execution finished: %s' % command_line) except Exception, exc: job_wrapper.fail( "failure running job", exception=True ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket