5 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/371f6770d25c/ changeset: 371f6770d25c user: dan date: 2012-09-27 17:46:12 summary: Refactor toolbox.get_tool. Store 'original tool.id' as tool.old_id. affected #: 1 file diff -r c28c5f906c6bdbbe799cfcc559760f26029090ce -r 371f6770d25cc5942fad87e8f43e8ce736c75838 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -291,34 +291,33 @@ os.chmod( self.integrated_tool_panel_config, 0644 ) def get_tool( self, tool_id, tool_version=None, get_all_versions=False ): """Attempt to locate a tool in the tool box.""" - if tool_id in self.tools_by_id: - tool = self.tools_by_id[ tool_id ] - if tool_version and tool.version == tool_version: - if get_all_versions: - return [ tool ] - else: - return tool - else: - if get_all_versions: - return [ tool ] - else: - return tool + if tool_id in self.tools_by_id and not get_all_versions: + #tool_id exactly matches an available tool by id (which is 'old' tool_id or guid) + return self.tools_by_id[ tool_id ] + #exact tool id match not found, or all versions requested, search for other options, e.g. migrated tools or different versions + rval = [] tv = self.__get_tool_version( tool_id ) if tv: tool_version_ids = tv.get_version_ids( self.app ) - if get_all_versions: - available_tool_versions = [] - for tool_version_id in tool_version_ids: - if tool_version_id in self.tools_by_id: - available_tool_versions.append( self.tools_by_id[ tool_version_id ] ) - return available_tool_versions for tool_version_id in tool_version_ids: if tool_version_id in self.tools_by_id: - tool = self.tools_by_id[ tool_version_id ] - if tool_version and tool.version == tool_version: - return tool - else: - return tool + rval.append( self.tools_by_id[ tool_version_id ] ) + if not rval: + #still no tool, do a deeper search and try to match by old ids + for tool in self.tools_by_id.itervalues(): + if tool.old_id == tool_id: + rval.append( tool ) + if rval: + if get_all_versions: + return rval + else: + if tool_version: + #return first tool with matching version + for tool in rval: + if tool.version == tool_version: + return tool + #No tool matches by version, simply return the first available tool found + return rval[0] return None def get_loaded_tools_by_lineage( self, tool_id ): """Get all loaded tools associated by lineage to the tool whose id is tool_id.""" @@ -381,7 +380,6 @@ tool.repository_owner = repository_owner tool.installed_changeset_revision = installed_changeset_revision tool.guid = guid - tool.old_id = elem.find( "id" ).text tool.version = elem.find( "version" ).text # Make sure the tool has a tool_version. if not self.__get_tool_version( tool.id ): @@ -906,8 +904,9 @@ if not self.name: raise Exception, "Missing tool 'name'" # Get the UNIQUE id for the tool + self.old_id = root.get( "id" ) if guid is None: - self.id = root.get( "id" ) + self.id = self.old_id else: self.id = guid if not self.id: https://bitbucket.org/galaxy/galaxy-central/changeset/5adfb582cca4/ changeset: 5adfb582cca4 user: dan date: 2012-09-27 17:46:12 summary: Refactor tool selection during rerun. Always allow selecting different versions of a tool when first accessed in tool_runner. affected #: 1 file diff -r 371f6770d25cc5942fad87e8f43e8ce736c75838 -r 5adfb582cca4305295f88d6128ccaa54c72a8977 lib/galaxy/web/controllers/tool_runner.py --- a/lib/galaxy/web/controllers/tool_runner.py +++ b/lib/galaxy/web/controllers/tool_runner.py @@ -50,27 +50,21 @@ tools = toolbox.get_loaded_tools_by_lineage( tool_id ) else: tools = toolbox.get_tool( tool_id, tool_version=tool_version, get_all_versions=True ) - if len( tools ) > 1: - tool_version_select_field = self.build_tool_version_select_field( tools, tool_id, set_selected ) - for tool in tools: - if tool.id == tool_id: - break - else: - tool = tools[ 0 ] - else: - tool = tools[ 0 ] - break + if tools: + tool = toolbox.get_tool( tool_id, tool_version=tool_version, get_all_versions=False ) + if len( tools ) > 1: + tool_version_select_field = self.build_tool_version_select_field( tools, tool.id, set_selected ) + break return tool_version_select_field, tools, tool @web.expose def index(self, trans, tool_id=None, from_noframe=None, **kwd): # No tool id passed, redirect to main page if tool_id is None: return trans.response.send_redirect( url_for( "/static/welcome.html" ) ) - set_selected = 'refresh' in kwd tool_version_select_field, tools, tool = self.__get_tool_components( tool_id, tool_version=None, - get_loaded_tools_by_lineage=True, - set_selected=set_selected ) + get_loaded_tools_by_lineage=False, + set_selected=True ) # No tool matching the tool id, display an error (shouldn't happen) if not tool: log.error( "index called with tool id '%s' but no such tool exists", tool_id ) https://bitbucket.org/galaxy/galaxy-central/changeset/c76e2882d2d2/ changeset: c76e2882d2d2 user: dan date: 2012-09-27 17:46:13 summary: Better handling of determining tool/version in workflow tool module. affected #: 1 file diff -r 5adfb582cca4305295f88d6128ccaa54c72a8977 -r c76e2882d2d23be86cb914df619af4b3e33911cf lib/galaxy/workflow/modules.py --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -199,13 +199,9 @@ # TODO: If workflows are ever enhanced to use tool version # in addition to tool id, enhance the selection process here # to retrieve the correct version of the tool. - tool_version = Class.__get_tool_version( trans, tool_id ) - if tool_version: - tool_version_ids = tool_version.get_version_ids( trans.app ) - for tool_version_id in tool_version_ids: - if tool_version_id in trans.app.toolbox.tools_by_id: - tool_id = tool_version_id - break + tool = trans.app.toolbox.get_tool( tool_id ) + if tool: + tool_id = tool.id if ( trans.app.toolbox and tool_id in trans.app.toolbox.tools_by_id ): module = Class( trans, tool_id ) module.state = DefaultToolState() https://bitbucket.org/galaxy/galaxy-central/changeset/e6289956e267/ changeset: e6289956e267 user: dan date: 2012-09-27 17:46:13 summary: Display tool version in workflow tool form editor. affected #: 1 file diff -r c76e2882d2d23be86cb914df619af4b3e33911cf -r e6289956e267c5e98b343b8ae1149b8af89a26e6 templates/workflow/editor_tool_form.mako --- a/templates/workflow/editor_tool_form.mako +++ b/templates/workflow/editor_tool_form.mako @@ -98,6 +98,9 @@ <div class="toolForm"><div class="toolFormTitle">Tool: ${tool.name}</div> + %if tool.version: + <div class="form-row"><div class='titleRow'>Version: ${tool.version}</div></div> + %endif <div class="toolFormBody"><input type="hidden" name="tool_id" value="${tool.id}" /> %for i, inputs in enumerate( tool.inputs_by_page ): https://bitbucket.org/galaxy/galaxy-central/changeset/0527905739fe/ changeset: 0527905739fe user: dan date: 2012-09-27 17:46:13 summary: Display tool version when running a workflow. affected #: 1 file diff -r e6289956e267c5e98b343b8ae1149b8af89a26e6 -r 0527905739fe10789de3d331a44dec3507bdfdb2 templates/workflow/run.mako --- a/templates/workflow/run.mako +++ b/templates/workflow/run.mako @@ -379,6 +379,9 @@ <div class="toolForm"><div class="toolFormTitle"><span class='title_ul_text'>Step ${int(step.order_index)+1}: ${tool.name}</span> + %if tool.version: + (version ${tool.version}) + %endif % if step.annotations: <div class="step-annotation">${h.to_unicode( step.annotations[0].annotation )}</div> % endif 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.