commit/galaxy-central: jgoecks: Provide option to retry dataset indexing/conversion in Trackster. Also, move is_true method into Web helpers for general access.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/014fee888b86/ changeset: 014fee888b86 user: jgoecks date: 2012-11-01 15:04:12 summary: Provide option to retry dataset indexing/conversion in Trackster. Also, move is_true method into Web helpers for general access. affected #: 4 files diff -r 5440f6b3bdecf081493aa31f473470fd11fecceb -r 014fee888b86f0c2f250cbe60ae9dfda9d0077a0 lib/galaxy/web/framework/helpers/__init__.py --- a/lib/galaxy/web/framework/helpers/__init__.py +++ b/lib/galaxy/web/framework/helpers/__init__.py @@ -90,4 +90,11 @@ return unicode( a_string, 'utf-8' ) elif a_string_type is unicode: return a_string + +def is_true ( val ): + """ + Returns true if input is a boolean and true or is a string and looks like a true value. + """ + return val == True or val in [ 'True', 'true', 'T', 't' ] + \ No newline at end of file diff -r 5440f6b3bdecf081493aa31f473470fd11fecceb -r 014fee888b86f0c2f250cbe60ae9dfda9d0077a0 lib/galaxy/webapps/galaxy/api/datasets.py --- a/lib/galaxy/webapps/galaxy/api/datasets.py +++ b/lib/galaxy/webapps/galaxy/api/datasets.py @@ -11,6 +11,7 @@ from galaxy.visualization.data_providers.basic import ColumnDataProvider from galaxy.datatypes.tabular import Vcf from galaxy.model import NoConverterException, ConverterDependencyException +from galaxy.web.framework.helpers import is_true log = logging.getLogger( __name__ ) @@ -42,7 +43,8 @@ if data_type == 'state': rval = self._dataset_state( trans, dataset ) elif data_type == 'converted_datasets_state': - rval = self._converted_datasets_state( trans, dataset, kwd.get( 'chrom', None ) ) + rval = self._converted_datasets_state( trans, dataset, kwd.get( 'chrom', None ), + is_true( kwd.get( 'retry', False ) ) ) elif data_type == 'data': rval = self._data( trans, dataset, **kwd ) elif data_type == 'features': @@ -72,22 +74,26 @@ return msg - def _converted_datasets_state( self, trans, dataset, chrom=None ): + def _converted_datasets_state( self, trans, dataset, chrom=None, retry=False ): """ - Init-like method that returns state of dataset's converted datasets. Returns valid chroms - for that dataset as well. + Init-like method that returns state of dataset's converted datasets. + Returns valid chroms for that dataset as well. """ - msg = self.check_dataset_state( trans, dataset ) if msg: return msg - # Get datasources and check for messages. + # Get datasources and check for messages (which indicate errors). Retry if flag is set. data_sources = dataset.get_datasources( trans ) messages_list = [ data_source_dict[ 'message' ] for data_source_dict in data_sources.values() ] msg = get_highest_priority_msg( messages_list ) if msg: - return msg + if retry: + # Clear datasources and then try again. + dataset.clear_associated_files() + return self._converted_datasets_state( trans, dataset, chrom ) + else: + return msg # If there is a chrom, check for data on the chrom. if chrom: diff -r 5440f6b3bdecf081493aa31f473470fd11fecceb -r 014fee888b86f0c2f250cbe60ae9dfda9d0077a0 lib/galaxy/webapps/galaxy/api/genomes.py --- a/lib/galaxy/webapps/galaxy/api/genomes.py +++ b/lib/galaxy/webapps/galaxy/api/genomes.py @@ -1,9 +1,7 @@ from galaxy import config, tools, web, util from galaxy.web.base.controller import BaseController, BaseAPIController from galaxy.util.bunch import Bunch - -def is_true ( a_str ): - return is_true == True or a_str in [ 'True', 'true', 'T', 't' ] +from galaxy.web.framework.helpers import is_true def get_id( base, format ): if format: diff -r 5440f6b3bdecf081493aa31f473470fd11fecceb -r 014fee888b86f0c2f250cbe60ae9dfda9d0077a0 static/scripts/viz/trackster/tracks.js --- a/static/scripts/viz/trackster/tracks.js +++ b/static/scripts/viz/trackster/tracks.js @@ -170,7 +170,7 @@ DEFAULT_DATA_QUERY_WAIT = 5000, // Maximum number of chromosomes that are selectable at any one time. MAX_CHROMS_SELECTABLE = 100, - DATA_ERROR = "There was an error in indexing this dataset. ", + DATA_ERROR = "Cannot display dataset due to an error. ", DATA_NOCONVERTER = "A converter for this dataset is not installed. Please check your datatypes_conf.xml file.", DATA_NONE = "No data for this chrom/contig.", DATA_PENDING = "Preparing data. This can take a while for a large dataset. " + @@ -2513,7 +2513,7 @@ /** * Initialize and draw the track. */ - init: function() { + init: function(retry) { var track = this; track.enabled = false; track.tile_cache.clear(); @@ -2525,7 +2525,7 @@ } */ // Remove old track content (e.g. tiles, messages). - track.tiles_div.children().remove(); + track.tiles_div.text('').children().remove(); track.container_div.removeClass("nodata error pending"); // @@ -2542,16 +2542,27 @@ params = { hda_ldda: track.hda_ldda, data_type: this.dataset_check_type, - chrom: track.view.chrom }; + chrom: track.view.chrom, + retry: retry + }; $.getJSON(this.dataset.url(), params, function (result) { if (!result || result === "error" || result.kind === "error") { + // Dataset is in error state. track.container_div.addClass("error"); track.tiles_div.text(DATA_ERROR); if (result.message) { - var error_link = $(" <a href='javascript:void(0);'></a>").text("View error").click(function() { - show_modal( "Trackster Error", "<pre>" + result.message + "</pre>", { "Close" : hide_modal } ); - }); - track.tiles_div.append(error_link); + // Add links to (a) show error and (b) try again. + track.tiles_div.append( + $("<a href='javascript:void(0);'></a>").text("View error").click(function() { + show_modal( "Trackster Error", "<pre>" + result.message + "</pre>", { "Close" : hide_modal } ); + }) + ); + track.tiles_div.append( $('<span/>').text(' ') ); + track.tiles_div.append( + $("<a href='javascript:void(0);'></a>").text("Try again").click(function() { + track.init(true); + }) + ); } } else if (result === "no converter") { track.container_div.addClass("error"); 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