commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/73dcfbfc744c/ Changeset: 73dcfbfc744c Branch: stable User: dan Date: 2013-12-12 23:09:29 Summary: When setting external metadata using _handle_metadata_externally (e.g. local and lwr runners) use the requirments of the set metadata tool to determine dependencies. Resolves issue seen with missing samtools command when samtools is not in the path, but has been installed with the dependency system. Affected #: 4 files diff -r a96ca602209ca2d4d732cced9530a62b3e4134a8 -r 73dcfbfc744c2336749df0276a5a727d672c6add lib/galaxy/datatypes/registry.py --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -585,6 +585,9 @@ tool_xml_text = """ <tool id="__SET_METADATA__" name="Set External Metadata" version="1.0.1" tool_type="set_metadata"><type class="SetMetadataTool" module="galaxy.tools"/> + <requirements> + <requirement type="package">samtools</requirement> + </requirements><action module="galaxy.tools.actions.metadata" class="SetMetadataToolAction"/><command>$__SET_EXTERNAL_METADATA_COMMAND_LINE__</command><inputs> diff -r a96ca602209ca2d4d732cced9530a62b3e4134a8 -r 73dcfbfc744c2336749df0276a5a727d672c6add lib/galaxy/jobs/runners/__init__.py --- a/lib/galaxy/jobs/runners/__init__.py +++ b/lib/galaxy/jobs/runners/__init__.py @@ -196,7 +196,7 @@ log.exception( "from_work_dir specified a location not in the working directory: %s, %s" % ( source_file, job_wrapper.working_directory ) ) return output_pairs - def _handle_metadata_externally(self, job_wrapper): + def _handle_metadata_externally( self, job_wrapper, resolve_requirements=False ): """ Set metadata externally. Used by the local and lwr job runners where this shouldn't be attached to command-line to execute. @@ -211,6 +211,12 @@ #we don't want to overwrite metadata that was copied over in init_meta(), as per established behavior kwds={ 'overwrite' : False } ) log.debug( 'executing external set_meta script for job %d: %s' % ( job_wrapper.job_id, external_metadata_script ) ) + if resolve_requirements: + dependency_shell_commands = self.app.datatypes_registry.set_external_metadata_tool.build_dependency_shell_commands() + if dependency_shell_commands: + if isinstance( dependency_shell_commands, list ): + dependency_shell_commands = "&&".join( dependency_shell_commands ) + external_metadata_script = "%s&&%s" % ( dependency_shell_commands, external_metadata_script ) external_metadata_proc = subprocess.Popen( args=external_metadata_script, shell=True, env=os.environ, diff -r a96ca602209ca2d4d732cced9530a62b3e4134a8 -r 73dcfbfc744c2336749df0276a5a727d672c6add lib/galaxy/jobs/runners/local.py --- a/lib/galaxy/jobs/runners/local.py +++ b/lib/galaxy/jobs/runners/local.py @@ -110,7 +110,7 @@ job_wrapper.fail( "failure running job", exception=True ) log.exception("failure running job %d" % job_wrapper.job_id) return - self._handle_metadata_externally( job_wrapper ) + self._handle_metadata_externally( job_wrapper, resolve_requirements=True ) # Finish the job! try: job_wrapper.finish( stdout, stderr, exit_code ) diff -r a96ca602209ca2d4d732cced9530a62b3e4134a8 -r 73dcfbfc744c2336749df0276a5a727d672c6add lib/galaxy/jobs/runners/lwr.py --- a/lib/galaxy/jobs/runners/lwr.py +++ b/lib/galaxy/jobs/runners/lwr.py @@ -154,7 +154,7 @@ job_wrapper.fail( message, exception=True ) log.exception("failure running job %d" % job_wrapper.job_id) return - self._handle_metadata_externally( job_wrapper ) + self._handle_metadata_externally( job_wrapper, resolve_requirements=True ) # Finish the job try: job_wrapper.finish( stdout, stderr ) https://bitbucket.org/galaxy/galaxy-central/commits/4e280310697b/ Changeset: 4e280310697b Branch: stable User: jmchilton Date: 2013-12-13 22:43:26 Summary: Use null object pattern to simplify logic related to no dependency manager being set. Fixes bug introduced in 4241eff related to dependency_manager being None if tool_dependency_dir is not set. Affected #: 4 files diff -r 73dcfbfc744c2336749df0276a5a727d672c6add -r 4e280310697b806aa0e08c80f342e2c93f1558f0 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -704,10 +704,7 @@ if self.command_line and self.command_line.startswith( 'python' ): self.galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root # Shell fragment to inject dependencies - if self.app.config.use_tool_dependencies: - self.dependency_shell_commands = self.tool.build_dependency_shell_commands() - else: - self.dependency_shell_commands = None + self.dependency_shell_commands = self.tool.build_dependency_shell_commands() # We need command_line persisted to the db in order for Galaxy to re-queue the job # if the server was stopped and restarted before the job finished job.command_line = self.command_line @@ -1451,10 +1448,7 @@ if self.command_line and self.command_line.startswith( 'python' ): self.galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root # Shell fragment to inject dependencies - if self.app.config.use_tool_dependencies: - self.dependency_shell_commands = self.tool.build_dependency_shell_commands() - else: - self.dependency_shell_commands = None + self.dependency_shell_commands = self.tool.build_dependency_shell_commands() # We need command_line persisted to the db in order for Galaxy to re-queue the job # if the server was stopped and restarted before the job finished task.command_line = self.command_line diff -r 73dcfbfc744c2336749df0276a5a727d672c6add -r 4e280310697b806aa0e08c80f342e2c93f1558f0 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -40,7 +40,7 @@ from galaxy.tools.actions import DefaultToolAction from galaxy.tools.actions.data_source import DataSourceToolAction from galaxy.tools.actions.data_manager import DataManagerToolAction -from galaxy.tools.deps import DependencyManager, INDETERMINATE_DEPENDENCY +from galaxy.tools.deps import build_dependency_manager from galaxy.tools.deps.requirements import parse_requirements_from_xml from galaxy.tools.parameters import check_param, params_from_strings, params_to_strings from galaxy.tools.parameters.basic import (BaseURLToolParameter, @@ -696,14 +696,7 @@ return stored.latest_workflow def init_dependency_manager( self ): - if self.app.config.use_tool_dependencies: - dependency_manager_kwds = { - 'default_base_path': self.app.config.tool_dependency_dir, - 'conf_file': self.app.config.dependency_resolvers_config_file, - } - self.dependency_manager = DependencyManager( **dependency_manager_kwds ) - else: - self.dependency_manager = None + self.dependency_manager = build_dependency_manager( self.app.config ) @property def sa_session( self ): diff -r 73dcfbfc744c2336749df0276a5a727d672c6add -r 4e280310697b806aa0e08c80f342e2c93f1558f0 lib/galaxy/tools/deps/__init__.py --- a/lib/galaxy/tools/deps/__init__.py +++ b/lib/galaxy/tools/deps/__init__.py @@ -15,6 +15,31 @@ from galaxy.util.submodules import submodules +def build_dependency_manager( config ): + if config.use_tool_dependencies: + dependency_manager_kwds = { + 'default_base_path': config.tool_dependency_dir, + 'conf_file': config.dependency_resolvers_config_file, + } + dependency_manager = DependencyManager( **dependency_manager_kwds ) + else: + dependency_manager = NullDependencyManager() + + return dependency_manager + + +class NullDependencyManager( object ): + + def uses_tool_shed_dependencies(self): + return False + + def dependency_shell_commands( self, requirements, **kwds ): + return [] + + def find_dep( self, name, version=None, type='package', **kwds ): + return INDETERMINATE_DEPENDENCY + + class DependencyManager( object ): """ A DependencyManager attempts to resolve named and versioned dependencies by diff -r 73dcfbfc744c2336749df0276a5a727d672c6add -r 4e280310697b806aa0e08c80f342e2c93f1558f0 lib/tool_shed/util/common_install_util.py --- a/lib/tool_shed/util/common_install_util.py +++ b/lib/tool_shed/util/common_install_util.py @@ -458,7 +458,7 @@ tool_dependency = tool_dependencies[ index ] if tool_dependency.can_install: try: - dependencies_ignored = app.toolbox.dependency_manager and not app.toolbox.dependency_manager.uses_tool_shed_dependencies() + dependencies_ignored = not app.toolbox.dependency_manager.uses_tool_shed_dependencies() if dependencies_ignored: log.info("Skipping package %s, tool shed dependency resolver not enabled." % package_name) # Tool dependency resolves have been configured and they do not 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)
-
commits-noreply@bitbucket.org