Improved handling of tools producing unicode in standard error/output.

Without this change (modification on idea by Bjoern), sqlite reports errors as follows for such tools:

ProgrammingError: (ProgrammingError) You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. u'UPDATE job SET update_time=?, stdout=?, stderr=? WHERE job.id = ?' ('2013-10-10 05:00:05.789309', '', '/dev/fd/2 unicode \xc3\xaa\xe0\xaf\xb3\xe0\xbe\x85\xe1\x9d\xb1\xe3\x8e\xb0\n', 11).
This commit is contained in:
John Chilton
2013-10-16 13:01:15 -05:00
parent 60488bf064
commit b464456c0b
+7
View File
@@ -25,6 +25,7 @@ from galaxy.jobs.runners import BaseJobRunner
from galaxy.util.bunch import Bunch
from galaxy.util.expressions import ExpressionContext
from galaxy.util.json import from_json_string
from galaxy.util import unicodify
from .output_checker import check_output
log = logging.getLogger( __name__ )
@@ -869,6 +870,9 @@ class JobWrapper( object ):
the output datasets based on stderr and stdout from the command, and
the contents of the output files.
"""
stdout = unicodify( stdout )
stderr = unicodify( stderr )
# default post job setup
self.sa_session.expunge_all()
job = self.get_job()
@@ -1518,6 +1522,9 @@ class TaskWrapper(JobWrapper):
the output datasets based on stderr and stdout from the command, and
the contents of the output files.
"""
stdout = unicodify( stdout )
stderr = unicodify( stderr )
# This may have ended too soon
log.debug( 'task %s for job %d ended; exit code: %d'
% (self.task_id, self.job_id,