commit/galaxy-central: greg: Enhance the Tool Shed fabric_util.wait_for_process method to timeout after a reasonable period of waiting for stderr or stdout during tool dependency package compilation.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ef5f750810f7/ Changeset: ef5f750810f7 User: greg Date: 2014-02-24 16:20:14 Summary: Enhance the Tool Shed fabric_util.wait_for_process method to timeout after a reasonable period of waiting for stderr or stdout during tool dependency package compilation. Affected #: 1 file diff -r f573461f3667e8f120dc05bbd11a019d5fae1960 -r ef5f750810f791d39d5fe37f256b2526fa9916ae lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py @@ -38,6 +38,7 @@ log = logging.getLogger( __name__ ) INSTALLATION_LOG = 'INSTALLATION.log' +NO_CMD_OUTPUT_TIMEOUT = 600 VIRTUALENV_URL = 'https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz' @@ -829,19 +830,46 @@ return env def wait_for_process( process_handle, stream_output, stdout_queue, stderr_queue ): + pid = process_handle.pid standard_out = [] standard_err = [] process_handle.wait() + # Generate stdout. while True: - line = stdout_queue.get() - if line is None: + try: + line = stdout_queue.get( timeout=NO_CMD_OUTPUT_TIMEOUT ) + except Queue.Empty: + err_msg = "\nShutting down process id %s because it generated no stdout for the defined timout period of %d seconds.\n" % \ + ( pid, NO_CMD_OUTPUT_TIMEOUT ) + print err_msg + standard_out.append( err_msg ) + stdout_queue.task_done() + process_handle.kill() break - standard_out.append(line) + else: + if line: + standard_out.append( line ) + else: + stdout_queue.task_done() + break + # Generate stderr. while True: - line = stderr_queue.get() - if line is None: + try: + line = stderr_queue.get( timeout=NO_CMD_OUTPUT_TIMEOUT ) + except Queue.Empty: + err_msg = "\nShutting down process id %s because it generated no stderr for the defined timout period of %d seconds.\n" % \ + ( pid, NO_CMD_OUTPUT_TIMEOUT ) + print err_msg + standard_err.append( err_msg ) + stderr_queue.task_done() + process_handle.kill() break - standard_err.append(line) + else: + if line: + standard_err.append( line ) + else: + stderr_queue.task_done() + break stdout = '\n'.join( standard_out ) stderr = '\n'.join( standard_err ) return stdout, stderr 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)
-
commits-noreply@bitbucket.org