Fix Python environment hack to allow "fixing" tool ids at some version.

This is a less broken alternative to #3620 and something I intended to ultimately do anyway.

sam-to-bam used to be broken but now it isn't, we need to express that. Ideally we would move most of the things from the unversioned list to the versioned list as they are fixed.

xref https://github.com/galaxyproject/galaxy/pull/3620#issuecomment-280674067
xref https://github.com/galaxyproject/galaxy/commit/fe2a1d8ade4fbda158ae035c78133258d7fec099#commitcomment-20900607
xref #3351
xref galaxyproject/tools-iuc#1148
This commit is contained in:
John Chilton
2017-02-17 11:28:49 -05:00
parent 56f7af455c
commit 62ee8e8404
+18 -3
View File
@@ -11,6 +11,7 @@ import tempfile
import threading
from cgi import FieldStorage
from datetime import datetime
from distutils.version import LooseVersion
from xml.etree import ElementTree
from mako.template import Template
@@ -98,7 +99,7 @@ log = logging.getLogger( __name__ )
HELP_UNINITIALIZED = threading.Lock()
MODEL_TOOLS_PATH = os.path.abspath(os.path.dirname(__file__))
# Tools that require Galaxy's Python environment to be preserved.
GALAXY_LIB_TOOLS = [
GALAXY_LIB_TOOLS_UNVERSIONED = [
"upload1",
# Legacy tools bundled with Galaxy.
"vcf_to_maf_customtrack1",
@@ -134,10 +135,14 @@ GALAXY_LIB_TOOLS = [
"sam_pileup",
"find_diag_hits",
"cufflinks",
"sam_to_bam", # This was fixed with version 1.1.3 of the tool - TODO add Galaxy to PYTHONPATH only for older versions
# Tools improperly migrated to the tool shed (iuc)
"tabular_to_dbnsfp",
]
# Tools that needed galaxy on the PATH in the past but no longer do along
# with the version at which they were fixed.
GALAXY_LIB_TOOLS_VERSIONED = {
"sam_to_bam": LooseVersion("1.1.3"),
}
class ToolErrorLog:
@@ -407,6 +412,10 @@ class Tool( object, Dictifiable ):
self.history_manager = histories.HistoryManager( app )
self._view = views.DependencyResolversView(app)
@property
def version_object(self):
return LooseVersion(self.version)
@property
def sa_session( self ):
"""Returns a SQLAlchemy session"""
@@ -479,7 +488,13 @@ class Tool( object, Dictifiable ):
elif preserve_python_environment == "legacy_and_local" and self.repository_id is None:
return True
else:
return self.old_id in GALAXY_LIB_TOOLS
unversioned_legacy_tool = self.old_id in GALAXY_LIB_TOOLS_UNVERSIONED
versioned_legacy_tool = self.old_id in GALAXY_LIB_TOOLS_VERSIONED
legacy_tool = unversioned_legacy_tool or versioned_legacy_tool
if not legacy_tool:
return False
else:
return unversioned_legacy_tool or self.version_object < GALAXY_LIB_TOOLS_VERSIONED[self.old_id]
def __get_job_tool_configuration(self, job_params=None):
"""Generalized method for getting this tool's job configuration.