commit/galaxy-central: inithello: Improved error handling for failed indexing jobs.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/0bfd0f25956e/ changeset: 0bfd0f25956e user: inithello date: 2012-08-16 21:43:02 summary: Improved error handling for failed indexing jobs. affected #: 2 files diff -r 35d80be976914c49759e17068a2ba65b752eb3b1 -r 0bfd0f25956e3be0f04f68c9e05c1d07f2948f98 lib/galaxy/tools/genome_index/__init__.py --- a/lib/galaxy/tools/genome_index/__init__.py +++ b/lib/galaxy/tools/genome_index/__init__.py @@ -18,13 +18,16 @@ <tool id="__GENOME_INDEX__" name="Index Genome" version="0.1" tool_type="genome_index"><type class="GenomeIndexTool" module="galaxy.tools"/><action module="galaxy.tools.actions.index_genome" class="GenomeIndexToolAction"/> - <command>$__GENOME_INDEX_COMMAND__ $output_file $output_file.files_path $__app__.config.rsync_url "$__app__.config.tool_data_path"</command> + <command>$__GENOME_INDEX_COMMAND__ $output_file $output_file.files_path "$__app__.config.rsync_url" "$__app__.config.tool_data_path"</command><inputs><param name="__GENOME_INDEX_COMMAND__" type="hidden"/></inputs><outputs><data format="txt" name="output_file"/></outputs> + <stdio> + <exit_code range="1:" err_level="fatal" /> + </stdio></tool> """ @@ -64,6 +67,18 @@ if gitd: + fp = open( gitd.dataset.get_file_name(), 'r' ) + deferred = sa_session.query( model.DeferredJob ).filter_by( id=gitd.deferred_job_id ).first() + try: + logloc = json.load( fp ) + except ValueError: + deferred.state = app.model.DeferredJob.states.ERROR + sa_session.add( deferred ) + sa_session.flush() + log.debug( 'Indexing job failed, setting deferred job state to error.' ) + return False + finally: + fp.close() destination = None tdtman = ToolDataTableManager( app.config.tool_data_path ) xmltree = tdtman.load_from_config_file( app.config.tool_data_table_config_path, app.config.tool_data_path ) @@ -72,16 +87,12 @@ location = node.findall('file')[0].get('path') self.locations[table] = os.path.abspath( location ) locbase = os.path.abspath( os.path.split( self.locations['all_fasta'] )[0] ) - deferred = sa_session.query( model.DeferredJob ).filter_by( id=gitd.deferred_job_id ).first() params = deferred.params dbkey = params[ 'dbkey' ] basepath = os.path.join( os.path.abspath( app.config.genome_data_path ), dbkey ) intname = params[ 'intname' ] indexer = gitd.indexer workingdir = os.path.abspath( gitd.dataset.extra_files_path ) - fp = open( gitd.dataset.get_file_name(), 'r' ) - logloc = json.load( fp ) - fp.close() location = [] indexdata = gitd.dataset.extra_files_path if indexer == '2bit': diff -r 35d80be976914c49759e17068a2ba65b752eb3b1 -r 0bfd0f25956e3be0f04f68c9e05c1d07f2948f98 lib/galaxy/tools/genome_index/index_genome.py --- a/lib/galaxy/tools/genome_index/index_genome.py +++ b/lib/galaxy/tools/genome_index/index_genome.py @@ -40,15 +40,16 @@ self.genome = os.path.splitext( self.fafile )[0] with WithChDir( self.basedir ): if indexer not in self.indexers: - raise KeyError, 'The requested indexing function does not exist' + sys.stderr.write( 'The requested indexing function does not exist' ) + exit(127) else: with WithChDir( self.workingdir ): self._log( 'Running indexer %s.' % indexer ) result = getattr( self, self.indexers[ indexer ] )() if result in [ None, False ]: - self._log( 'Error running indexer %s, %s' % ( indexer, result ) ) + sys.stderr.write( 'Error running indexer %s, %s' % ( indexer, result ) ) self._flush_files() - return True + exit(1) else: self._log( self.locations ) self._log( 'Indexer %s completed successfully.' % indexer ) @@ -309,5 +310,7 @@ # Create archive. idxobj = ManagedIndexer( outfile, infile, working_dir, rsync_url, tooldata ) - idxobj.run_indexer( indexer ) - \ No newline at end of file + returncode = idxobj.run_indexer( indexer ) + if not returncode: + exit(1) + exit(0) \ No newline at end of file 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