[hg] galaxy 2507: A new flag, force_history_refresh, has been ad...

details: http://www.bx.psu.edu/hg/galaxy/rev/0f18a77ca03e changeset: 2507:0f18a77ca03e user: Dan Blankenberg <dan@bx.psu.edu> date: Mon Jul 27 15:55:32 2009 -0400 description: A new flag, force_history_refresh, has been added to Tool Configurations. When set to "True", this flag will cause the entire history to reload when one of its outputs has finished running. Default is False. This is useful, i.e., when a tool creates an indeterminate number of output datasets by dumping them into new_file_path. Example: <tool id="someTool" name="Some tool name" version="1.0.1" force_history_refresh="True"> ... </tool> 3 file(s) affected in this change: lib/galaxy/tools/__init__.py lib/galaxy/web/controllers/root.py templates/root/history.mako diffs (68 lines): diff -r ae750790079a -r 0f18a77ca03e lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py Mon Jul 27 11:33:12 2009 -0400 +++ b/lib/galaxy/tools/__init__.py Mon Jul 27 15:55:32 2009 -0400 @@ -295,6 +295,8 @@ self.is_multi_byte = util.string_as_bool( root.get( "is_multi_byte", False ) ) # Type of tool self.tool_type = root.get( "tool_type", None ) + #Force history to fully refresh after job execution for this tool. Useful i.e. when an indeterminate number of outputs are created by a tool. + self.force_history_refresh = util.string_as_bool( root.get( 'force_history_refresh', 'False' ) ) # data_source tool if self.tool_type == "data_source": self.URL_method = root.get( "URL_method", "get" ) # get is the default diff -r ae750790079a -r 0f18a77ca03e lib/galaxy/web/controllers/root.py --- a/lib/galaxy/web/controllers/root.py Mon Jul 27 11:33:12 2009 -0400 +++ b/lib/galaxy/web/controllers/root.py Mon Jul 27 15:55:32 2009 -0400 @@ -114,9 +114,16 @@ for id, state in zip( ids, states ): data = self.app.model.HistoryDatasetAssociation.get( id ) if data.state != state: + job_hda = data + while job_hda.copied_from_history_dataset_association: + job_hda = job_hda.copied_from_history_dataset_association + force_history_refresh = False + if job_hda.creating_job_associations: + force_history_refresh = trans.app.toolbox.tools_by_id[ job_hda.creating_job_associations[ 0 ].job.tool_id ].force_history_refresh rval[id] = { "state": data.state, - "html": unicode( trans.fill_template( "root/history_item.mako", data=data, hid=data.hid ), 'utf-8' ) + "html": unicode( trans.fill_template( "root/history_item.mako", data=data, hid=data.hid ), 'utf-8' ), + "force_history_refresh": force_history_refresh } return rval diff -r ae750790079a -r 0f18a77ca03e templates/root/history.mako --- a/templates/root/history.mako Mon Jul 27 11:33:12 2009 -0400 +++ b/templates/root/history.mako Mon Jul 27 15:55:32 2009 -0400 @@ -186,6 +186,7 @@ // Build request data var ids = [] var states = [] + var force_history_refresh = false $.each( tracked_datasets, function ( id, state ) { ids.push( id ); states.push( state ); @@ -205,13 +206,21 @@ initShowHide(); // If new state was terminal, stop tracking if (( val.state == "ok") || ( val.state == "error") || ( val.state == "empty") || ( val.state == "deleted" ) || ( val.state == "discarded" )) { + if ( val.force_history_refresh ){ + force_history_refresh = true; + } delete tracked_datasets[ parseInt(id) ]; } else { tracked_datasets[ parseInt(id) ] = val.state; } }); - // Keep going (if there are still any items to track) - updater( tracked_datasets ); + if ( force_history_refresh ) { + parent.frames.galaxy_history.location.reload(); + } + else { + // Keep going (if there are still any items to track) + updater( tracked_datasets ); + } }, error: function() { // Just retry, like the old method, should try to be smarter
participants (1)
-
Nate Coraor