Warning
This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
Source code for galaxy.tools.deps.container_resolvers.explicit
"""This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import logging
from ..container_resolvers import (
ContainerResolver,
)
log = logging.getLogger(__name__)
[docs]class ExplicitContainerResolver(ContainerResolver):
"""Find explicit containers referenced in the tool description (e.g. tool XML file) if present."""
resolver_type = "explicit"
[docs] def resolve(self, enabled_container_types, tool_info, **kwds):
"""Find a container explicitly mentioned in tool description.
This ignores the tool requirements and assumes the tool author crafted
a correct container.
"""
for container_description in tool_info.container_descriptions:
if self._container_type_enabled(container_description, enabled_container_types):
return container_description
return None
[docs]class ExplicitSingularityContainerResolver(ExplicitContainerResolver):
resolver_type = 'explicit_singularity'
container_type = 'singularity'
[docs] def resolve(self, enabled_container_types, tool_info, **kwds):
"""Find a container explicitly mentioned in tool description.
This ignores the tool requirements and assumes the tool author crafted
a correct container. We use singularity here to fetch docker containers,
hence the container_description hack here.
"""
for container_description in tool_info.container_descriptions:
if container_description.type == 'docker':
desc_dict = container_description.to_dict()
desc_dict['type'] = self.container_type
desc_dict['identifier'] = "docker://%s" % container_description.identifier
container_description = container_description.from_dict(desc_dict)
if self._container_type_enabled(container_description, enabled_container_types):
return container_description
return None
__all__ = ("ExplicitContainerResolver", "ExplicitSingularityContainerResolver")