commit/galaxy-central: dan: Fixes for showing job parameters when tools have been updated.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/71a616ffce1c/ changeset: 71a616ffce1c user: dan date: 2013-01-11 20:41:12 summary: Fixes for showing job parameters when tools have been updated. affected #: 3 files diff -r e9f81b5154bb71c6c12d4591c8f9519e52c93212 -r 71a616ffce1c85aa31d3e5311d5babfc12c49381 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1347,7 +1347,7 @@ rval = [] for val in value: rval.append( get_option_display( val, self.options ) or val ) - return "\n".join( rval ) + suffix + return "\n".join( map( str, rval ) ) + suffix def get_dependencies( self ): """ @@ -1611,9 +1611,11 @@ if value and not isinstance( value, list ): value = [ value ] if value: - return ", ".join( [ "%s: %s" % ( item.hid, item.name ) for item in value ] ) - else: - return "No dataset" + try: + return ", ".join( [ "%s: %s" % ( item.hid, item.name ) for item in value ] ) + except: + pass + return "No dataset" def validate( self, value, history=None ): for validator in self.validators: diff -r e9f81b5154bb71c6c12d4591c8f9519e52c93212 -r 71a616ffce1c85aa31d3e5311d5babfc12c49381 lib/galaxy/webapps/galaxy/controllers/dataset.py --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -997,6 +997,8 @@ params_objects = None job = None tool = None + upgrade_messages = {} + has_parameter_errors = False inherit_chain = hda.source_dataset_chain if inherit_chain: job_dataset_association, dataset_association_container_name = inherit_chain[-1] @@ -1013,12 +1015,19 @@ toolbox = self.get_toolbox() tool = toolbox.get_tool( job.tool_id ) assert tool is not None, 'Requested tool has not been loaded.' - params_objects = job.get_param_values( trans.app ) + #Load parameter objects, if a parameter type has changed, its possible for the value to no longer be valid + try: + params_objects = job.get_param_values( trans.app, ignore_errors=False ) + except: + params_objects = job.get_param_values( trans.app, ignore_errors=True ) + upgrade_messages = tool.check_and_update_param_values( job.get_param_values( trans.app, ignore_errors=True ), trans, update_values=False ) #use different param_objects here, since we want to display original values as much as possible + has_parameter_errors = True except: pass if job is None: return trans.show_error_message( "Job information is not available for this dataset." ) - return trans.fill_template( "show_params.mako", inherit_chain=inherit_chain, history=trans.get_history(), hda=hda, job=job, tool=tool, params_objects=params_objects ) + #TODO: we should provide the basic values along with the objects, in order to better handle reporting of old values during upgrade + return trans.fill_template( "show_params.mako", inherit_chain=inherit_chain, history=trans.get_history(), hda=hda, job=job, tool=tool, params_objects=params_objects, upgrade_messages=upgrade_messages, has_parameter_errors=has_parameter_errors ) @web.expose def copy_datasets( self, trans, source_history=None, source_dataset_ids="", target_history_id=None, target_history_ids="", new_history_name="", do_copy=False, **kwd ): diff -r e9f81b5154bb71c6c12d4591c8f9519e52c93212 -r 71a616ffce1c85aa31d3e5311d5babfc12c49381 templates/show_params.mako --- a/templates/show_params.mako +++ b/templates/show_params.mako @@ -1,4 +1,5 @@ <%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /><% from galaxy.util import nice_size %><style> @@ -10,7 +11,11 @@ } </style> -<%def name="inputs_recursive( input_params, param_values, depth=1 )"> +<%def name="inputs_recursive( input_params, param_values, depth=1, upgrade_messages=None )"> + <% + if upgrade_messages is None: + upgrade_messages = {} + %> %for input_index, input in enumerate( input_params.itervalues() ): %if input.name in param_values: %if input.type == "repeat": @@ -18,17 +23,47 @@ ${ inputs_recursive(input.inputs, param_values[input.name][i], depth=depth+1) } %endfor %elif input.type == "conditional": - <% current_case = param_values[input.name]['__current_case__'] %> + <% + try: + current_case = param_values[input.name]['__current_case__'] + is_valid = True + except: + current_case = None + is_valid = False + %> + %if is_valid: + <tr> + ${ inputs_recursive_indent( text=input.test_param.label, depth=depth )} + ##<!-- Get the value of the current Conditional parameter --> + <td>${input.cases[current_case].value | h}</td> + <td></td> + </tr> + ${ inputs_recursive( input.cases[current_case].inputs, param_values[input.name], depth=depth+1, upgrade_messages=upgrade_messages.get( input.name ) ) } + %else: + <tr> + ${ inputs_recursive_indent( text=input.name, depth=depth )} + <td><em>The previously used value is no longer valid</em></td> + <td></td> + </tr> + %endif + %elif input.type == "upload_dataset": + <tr> + ${inputs_recursive_indent( text=input.group_title( param_values ), depth=depth )} + <td>${ len( param_values[input.name] ) } uploaded datasets</td> + <td></td> + </tr> + %elif input.visible: + <% + if hasattr( input, "label" ) and input.label: + label = input.label + else: + #value for label not required, fallback to input name (same as tool panel) + label = input.name + %><tr> - ${ inputs_recursive_indent( text=input.test_param.label, depth=depth )} - <!-- Get the value of the current Conditonal parameter --> - <td>${input.cases[current_case].value}</td> - </tr> - ${ inputs_recursive(input.cases[current_case].inputs, param_values[input.name], depth=depth+1) } - %elif getattr(input, "label", None): - <tr> - ${inputs_recursive_indent( text=input.label, depth=depth )} - <td>${input.value_to_display_text(param_values[input.name], trans.app)}</td> + ${inputs_recursive_indent( text=label, depth=depth )} + <td>${input.value_to_display_text( param_values[input.name], trans.app ) | h}</td> + <td>${ upgrade_messages.get( input.name, '' ) | h }</td></tr> %endif %else: @@ -38,11 +73,14 @@ # Get parameter label. if input.type == "conditional": label = input.test_param.label + elif input.type == "repeat": + label = input.label() else: - label = input.label + label = input.label or input.name %> ${inputs_recursive_indent( text=label, depth=depth )} <td><em>not used (parameter was added after this job was run)</em></td> + <td></td></tr> %endif @@ -52,7 +90,7 @@ ## function to add a indentation depending on the depth in a <tr><%def name="inputs_recursive_indent( text, depth )"><td style="padding-left: ${ ( depth - 1 ) * 10 }px"> - ${text} + ${text | h} </td></%def> @@ -60,50 +98,57 @@ <thead><tr><th colspan="2" style="font-size: 120%;"> % if tool: - Tool: ${tool.name} + Tool: ${tool.name | h} % else: Unknown Tool % endif </th></tr></thead><tbody> - <tr><td>Name:</td><td>${hda.name}</td></tr> + <tr><td>Name:</td><td>${hda.name | h}</td></tr><tr><td>Created:</td><td>${hda.create_time.strftime("%b %d, %Y")}</td></tr> ## <tr><td>Copied from another history?</td><td>${hda.source_library_dataset}</td></tr><tr><td>Filesize:</td><td>${nice_size(hda.dataset.file_size)}</td></tr> - <tr><td>Dbkey:</td><td>${hda.dbkey}</td></tr> - <tr><td>Format:</td><td>${hda.ext}</td></tr> - <tr><td>Tool Version:</td><td>${hda.tool_version}</td></tr> + <tr><td>Dbkey:</td><td>${hda.dbkey | h}</td></tr> + <tr><td>Format:</td><td>${hda.ext | h}</td></tr> + <tr><td>Tool Version:</td><td>${hda.tool_version | h}</td></tr><tr><td>Tool Standard Output:</td><td><a href="${h.url_for( controller='dataset', action='stdout')}">stdout</a></td></tr><tr><td>Tool Standard Error:</td><td><a href="${h.url_for( controller='dataset', action='stderr')}">stderr</a></td></tr> - <tr><td>Tool Exit Code:</td><td>${job.exit_code}</td></tr> + <tr><td>Tool Exit Code:</td><td>${job.exit_code | h}</td></tr> %if trans.user_is_admin() or trans.app.config.expose_dataset_path: - <tr><td>Full Path:</td><td>${hda.file_name}</td></tr> + <tr><td>Full Path:</td><td>${hda.file_name | h}</td></tr> %endif </table><br /> + <table class="tabletip"><thead><tr><th>Input Parameter</th><th>Value</th> + <th>Note for rerun</th></tr></thead><tbody> % if params_objects and tool: - ${ inputs_recursive(tool.inputs, params_objects, depth=1) } + ${ inputs_recursive( tool.inputs, params_objects, depth=1, upgrade_messages=upgrade_messages ) } + %elif params_objects is None: + <tr><td colspan="2">Unable to load parameters.</td></tr> % else: <tr><td colspan="2">No parameters.</td></tr> % endif </tbody></table> - +%if has_parameter_errors: + <br /> + ${ render_msg( 'One or more of your original parameters may no longer be valid or displayed properly.', status='warning' ) } +%endif <h3>Inheritance Chain</h3> - <div class="inherit" style="background-color: #fff; font-weight:bold;">${hda.name}</div> + <div class="inherit" style="background-color: #fff; font-weight:bold;">${hda.name | h}</div> % for dep in inherit_chain: <div style="font-size: 36px; text-align: center;">↑</div> - <div class="inherit">${dep[0].name}<br/>${dep[1]}</div> + <div class="inherit">${dep[0].name | h}<br/>${dep[1]}</div> % endfor 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