1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/f7d0c01430f7/ changeset: f7d0c01430f7 user: jgoecks date: 2012-07-02 01:03:16 summary: Prevent more than 10 jobs from being run at once in paramamonster. Additional paramamonster bug fixes as well. affected #: 4 files diff -r 81d637b6fdad65d74fdccd02c7d71e0e6eaf37dd -r f7d0c01430f761a73db0f7dc18bd025ad6768575 lib/galaxy/web/api/tools.py --- a/lib/galaxy/web/api/tools.py +++ b/lib/galaxy/web/api/tools.py @@ -142,31 +142,32 @@ # There is a list of regions. regions = [ GenomeRegion.from_dict( r ) for r in regions ] - # Sort by chrom name, start so that data is not fetched out of order. - regions.sort( key=lambda r: r.chrom ) - regions.sort( key=lambda r: r.start ) + if len( regions ) > 1: + # Sort by chrom name, start so that data is not fetched out of order. + regions.sort( key=lambda r: r.chrom ) + regions.sort( key=lambda r: r.start ) - # Merge overlapping regions so that regions do not overlap - # and hence data is not included multiple times. - prev = regions[0] - cur = regions[1] - index = 1 - while True: - if cur.start <= prev.end: - # Found overlapping regions, so join them. - prev.end = cur.end - del regions[ index ] - else: - # No overlap, move to next region. - prev = cur - index += 1 + # Merge overlapping regions so that regions do not overlap + # and hence data is not included multiple times. + prev = regions[0] + cur = regions[1] + index = 1 + while True: + if cur.start <= prev.end: + # Found overlapping regions, so join them. + prev.end = cur.end + del regions[ index ] + else: + # No overlap, move to next region. + prev = cur + index += 1 - # Get next region or exit. - if index == len( regions ): - # Done. - break - else: - cur = regions[ index ] + # Get next region or exit. + if index == len( regions ): + # Done. + break + else: + cur = regions[ index ] run_on_regions = True diff -r 81d637b6fdad65d74fdccd02c7d71e0e6eaf37dd -r f7d0c01430f761a73db0f7dc18bd025ad6768575 static/scripts/viz/paramamonster.js --- a/static/scripts/viz/paramamonster.js +++ b/static/scripts/viz/paramamonster.js @@ -595,7 +595,7 @@ // Layout tree. var cluster = d3.layout.cluster() - .size([this.height - 10, this.width - 160]); + .size([this.height, this.width - 160]); var diagonal = d3.svg.diagonal() .projection(function(d) { return [d.y, d.x]; }); @@ -617,7 +617,7 @@ var vis = d3.select(this.$el[0]) .append("svg") .attr("width", this.width) - .attr("height", this.height) + .attr("height", this.height + 20) .append("g") .attr("transform", "translate(40, 10)"); @@ -754,39 +754,57 @@ regions = this.model.get('regions'), node = d3.select(this.tool_param_tree_view.$el[0]).selectAll("g.node"); node.on("click", function(d, i) { - // TODO: Show popup menu. - // Get all settings corresponding to node. var tool = self.model.get('tool'), dataset = self.model.get('dataset'), - all_settings = param_tree.get_node_settings(d); + all_settings = param_tree.get_node_settings(d), + run_jobs_deferred = $.Deferred(); - // Create and add tracks for each settings group. - var tracks = _.map(all_settings, function(settings) { - var pm_track = new ParamaMonsterTrack({ - settings: settings, - regions: regions + // Do not allow 10+ jobs to be run. + if (all_settings.length >= 10) { + show_modal("Whoa there cowboy!", + "You clicked on a node to try " + self.model.get('tool').get('name') + + " with " + all_settings.length + + " different combinations of settings. You can only run 10 jobs at a time.", + { + "Ok": function() { hide_modal(); run_jobs_deferred.resolve(false); } + }); + } + else { + run_jobs_deferred.resolve(true); + } + + // Take action when deferred resolves. + $.when(run_jobs_deferred).then(function(run_jobs) { + if (!run_jobs) { return; } + + // Create and add tracks for each settings group. + var tracks = _.map(all_settings, function(settings) { + var pm_track = new ParamaMonsterTrack({ + settings: settings, + regions: regions + }); + self.add_track(pm_track); + return pm_track; }); - self.add_track(pm_track); - return pm_track; - }); - - // For each track, run tool using track's settings and update track. - _.each(tracks, function(pm_track, index) { - setTimeout(function() { - // Set inputs and run tool. - // console.log('running with settings', pm_track.get('settings')); - tool.set_input_values(pm_track.get('settings')); - $.when(tool.rerun(dataset, regions)).then(function(output) { - // Create and add track for output dataset. - var track_config = _.extend({ - data_url: galaxy_paths.get('raw_data_url'), - converted_datasets_state_url: galaxy_paths.get('dataset_state_url') - }, output.first().get('track_config')), - track_obj = object_from_template(track_config, self, null); - pm_track.set('track', track_obj); - }); - }, index * 10000); + + // For each track, run tool using track's settings and update track. + _.each(tracks, function(pm_track, index) { + setTimeout(function() { + // Set inputs and run tool. + // console.log('running with settings', pm_track.get('settings')); + tool.set_input_values(pm_track.get('settings')); + $.when(tool.rerun(dataset, regions)).then(function(output) { + // Create and add track for output dataset. + var track_config = _.extend({ + data_url: galaxy_paths.get('raw_data_url'), + converted_datasets_state_url: galaxy_paths.get('dataset_state_url') + }, output.first().get('track_config')), + track_obj = object_from_template(track_config, self, null); + pm_track.set('track', track_obj); + }); + }, index * 10000); + }); }); }); } diff -r 81d637b6fdad65d74fdccd02c7d71e0e6eaf37dd -r f7d0c01430f761a73db0f7dc18bd025ad6768575 static/scripts/viz/trackster.js --- a/static/scripts/viz/trackster.js +++ b/static/scripts/viz/trackster.js @@ -3063,11 +3063,11 @@ } else if (regions_to_use === 'bookmarks') { // Use only bookmarks. - regions = new Backbone.Collection(bookmarked_regions); + regions = bookmarked_regions; } else { // Use both current region and bookmarks. - regions = new Backbone.Collection([ view_region ].concat(bookmarked_regions)); + regions = [ view_region ].concat(bookmarked_regions); } hide_modal(); @@ -3078,7 +3078,7 @@ $.param({ dataset_id: track.dataset_id, hda_ldda: track.hda_ldda, - regions: JSON.stringify(regions.toJSON()) + regions: JSON.stringify(new Backbone.Collection(regions).toJSON()) }); }, check_enter_esc = function(e) { diff -r 81d637b6fdad65d74fdccd02c7d71e0e6eaf37dd -r f7d0c01430f761a73db0f7dc18bd025ad6768575 templates/visualization/paramamonster.mako --- a/templates/visualization/paramamonster.mako +++ b/templates/visualization/paramamonster.mako @@ -91,7 +91,7 @@ .tiles { overflow: auto; position: absolute; - top: 25px; + top: 30px; bottom: 25px; left: 0; right: 0; 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.