commit/galaxy-central: Scott McManus: Adding in exit code management for local changes; I'm holding off on the PBS and generic DRMAA runners until they're tested.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/06249bb8e6c9/ changeset: 06249bb8e6c9 user: Scott McManus date: 2012-06-20 08:14:55 summary: Adding in exit code management for local changes; I'm holding off on the PBS and generic DRMAA runners until they're tested. affected #: 4 files diff -r f1c5d6639f2efcf0eec530d1901c9816d65b32b0 -r 06249bb8e6c9be1e2f94fbd860f123f4ae51a356 lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py +++ b/lib/galaxy/datatypes/data.py @@ -284,6 +284,7 @@ return open( dataset.file_name ) def display_data(self, trans, data, preview=False, filename=None, to_ext=None, size=None, offset=None, **kwd): + raise Exception """ Old display method, for transition """ #Relocate all composite datatype display to a common location. composite_extensions = trans.app.datatypes_registry.get_composite_extensions( ) diff -r f1c5d6639f2efcf0eec530d1901c9816d65b32b0 -r 06249bb8e6c9be1e2f94fbd860f123f4ae51a356 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -285,12 +285,14 @@ self.sa_session.add( job ) self.sa_session.flush() - def finish( self, stdout, stderr ): + def finish( self, stdout, stderr, tool_exit_code=0 ): """ Called to indicate that the associated command has been run. Updates the output datasets based on stderr and stdout from the command, and the contents of the output files. """ + # TODO: Eliminate debugging code after testing all runners + log.debug( "JobWrapper.finish: exit code:" + str(tool_exit_code) ) # default post job setup self.sa_session.expunge_all() job = self.get_job() @@ -317,17 +319,15 @@ # that range, then apply the error level and add in a message. # If we've reached a fatal error rule, then stop. max_error_level = galaxy.tools.StdioErrorLevel.NO_ERROR - for exit_code in self.tool.stdio_exit_codes: - # TODO: Fetch the exit code from the .rc file: - tool_exit_code = 0 - if ( tool_exit_code >= exit_code.range_start and - tool_exit_code <= exit_code.range_end ): - if None != exit_code.desc: - err_msg += exit_code.desc + for stdio_exit_code in self.tool.stdio_exit_codes: + if ( tool_exit_code >= stdio_exit_code.range_start and + tool_exit_code <= stdio_exit_code.range_end ): + if None != stdio_exit_code.desc: + err_msg += stdio_exit_code.desc # TODO: Find somewhere to stick the err_msg - possibly to # the source (stderr/stdout), possibly in a new db column. max_error_level = max( max_error_level, - exit_code.error_level ) + stdio_exit_code.error_level ) if max_error_level >= galaxy.tools.StdioErrorLevel.FATAL: break # If there is a regular expression for scanning stdout/stderr, diff -r f1c5d6639f2efcf0eec530d1901c9816d65b32b0 -r 06249bb8e6c9be1e2f94fbd860f123f4ae51a356 lib/galaxy/jobs/handler.py --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -368,6 +368,7 @@ start_job_runners.append("tasks") for name in start_job_runners: self._load_plugin( name ) + log.debug( "Job runners: " + ':'.join( start_job_runners ) ) def _load_plugin( self, name ): module_name = 'galaxy.jobs.runners.' + name @@ -397,6 +398,7 @@ def put( self, job_wrapper ): try: runner_name = self.__get_runner_name( job_wrapper ) + log.debug( "Runner_name: " + runner_name ) if self.app.config.use_tasked_jobs and job_wrapper.tool.parallelism is not None and isinstance(job_wrapper, TaskWrapper): #DBTODO Refactor log.debug( "dispatching task %s, of job %d, to %s runner" %( job_wrapper.task_id, job_wrapper.job_id, runner_name ) ) diff -r f1c5d6639f2efcf0eec530d1901c9816d65b32b0 -r 06249bb8e6c9be1e2f94fbd860f123f4ae51a356 lib/galaxy/jobs/runners/local.py --- a/lib/galaxy/jobs/runners/local.py +++ b/lib/galaxy/jobs/runners/local.py @@ -54,6 +54,7 @@ def run_job( self, job_wrapper ): job_wrapper.set_runner( 'local:///', None ) stderr = stdout = command_line = '' + exit_code = 0 # Prepare the job to run try: job_wrapper.prepare() @@ -99,7 +100,11 @@ if sleep_time < 8: # So we don't stat every second sleep_time *= 2 - proc.wait() # reap + # Reap the process and get the exit code. The exit code should + # only be None if the process isn't finished, but check anyway. + exit_code = proc.wait() # reap + if None == exit_code: + exit_code = 0 stdout_file.seek( 0 ) stderr_file.seek( 0 ) stdout = stdout_file.read( 32768 ) @@ -128,9 +133,9 @@ external_metadata_proc.wait() log.debug( 'execution of external set_meta for job %d finished' % job_wrapper.job_id ) - # Finish the job + # Finish the job! try: - job_wrapper.finish( stdout, stderr ) + job_wrapper.finish( stdout, stderr, exit_code ) except: log.exception("Job wrapper finish method failed") job_wrapper.fail("Unable to finish 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