mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Allow more rich container description in job_conf.xml.
This commit is contained in:
@@ -469,13 +469,20 @@ class JobConfiguration( object ):
|
||||
rval = {}
|
||||
for param in parent.findall('param'):
|
||||
key = param.get('id')
|
||||
param_value = param.text
|
||||
if key in ["container", "container_override"]:
|
||||
from galaxy.tools.deps import requirements
|
||||
containers = map(requirements.container_from_element, list(param))
|
||||
param_value = map(lambda c: c.to_dict(), containers)
|
||||
else:
|
||||
param_value = param.text
|
||||
|
||||
if 'from_environ' in param.attrib:
|
||||
environ_var = param.attrib['from_environ']
|
||||
param_value = os.environ.get(environ_var, param_value)
|
||||
elif 'from_config' in param.attrib:
|
||||
config_val = param.attrib['from_config']
|
||||
param_value = self.app.config.config_dict.get(config_val, param_value)
|
||||
|
||||
rval[key] = param_value
|
||||
return rval
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import six
|
||||
|
||||
from galaxy.util import asbool
|
||||
from ..deps import docker_util
|
||||
from .requirements import ContainerDescription
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -59,6 +60,13 @@ class ContainerFinder(object):
|
||||
)
|
||||
return container
|
||||
|
||||
if "container_override" in destination_info:
|
||||
container_description = ContainerDescription.from_dict(destination_info["container_override"][0])
|
||||
if container_description:
|
||||
container = __destination_container(container_description)
|
||||
if container:
|
||||
return container
|
||||
|
||||
# Is destination forcing Galaxy to use a particular container do it,
|
||||
# this is likely kind of a corner case. For instance if deployers
|
||||
# do not trust the containers annotated in tools.
|
||||
@@ -90,6 +98,13 @@ class ContainerFinder(object):
|
||||
|
||||
# If we still don't have a container, check to see if any container
|
||||
# types define a default container id and use that.
|
||||
if "container" in destination_info:
|
||||
container_description = ContainerDescription.from_dict(destination_info["container"][0])
|
||||
if container_description:
|
||||
container = __destination_container(container_description)
|
||||
if container:
|
||||
return container
|
||||
|
||||
for container_type in CONTAINER_CLASSES.keys():
|
||||
container_id = self.__default_container_id(container_type, destination_info)
|
||||
if container_id:
|
||||
|
||||
@@ -92,11 +92,16 @@ def parse_requirements_from_xml( xml_root ):
|
||||
if requirements_elem is not None:
|
||||
container_elems = requirements_elem.findall( 'container' )
|
||||
|
||||
containers = []
|
||||
for container_elem in container_elems:
|
||||
identifier = xml_text( container_elem )
|
||||
type = container_elem.get( "type", DEFAULT_CONTAINER_TYPE )
|
||||
container = ContainerDescription( identifier=identifier, type=type )
|
||||
containers.append( container )
|
||||
containers = map(container_from_element, container_elems)
|
||||
|
||||
return requirements, containers
|
||||
|
||||
|
||||
def container_from_element(container_elem):
|
||||
identifier = xml_text(container_elem)
|
||||
type = container_elem.get("type", DEFAULT_CONTAINER_TYPE)
|
||||
container = ContainerDescription(
|
||||
identifier=identifier,
|
||||
type=type,
|
||||
)
|
||||
return container
|
||||
|
||||
Reference in New Issue
Block a user