Merge pull request #2278 from bgruening/htcondor_docker

HTCondor Docker Integration
This commit is contained in:
John Chilton
2016-05-17 11:12:07 -04:00
4 changed files with 41 additions and 1 deletions
+20
View File
@@ -434,6 +434,26 @@
<param> tags.
-->
<param id="request_cpus">8</param>
<!-- Recent version of HTCondor do have a `docker` universe to handle containers.
Activate this feature by explicitly specifying the `docker` universe.
-->
<!-- <param id="universe">docker</param> -->
<!-- If the tool has a container specified this one is used.
<requirements>
<container type="docker">bgruening/galaxy-stable</container>
</requirements>
Unless the job destination specifies an override
with docker_container_id_override. If neither of
these is set a default container can be specified
with docker_default_container_id. The resolved
container ID will be passed along to condor as
the docker_image submission parameter.
-->
<!-- <param id="docker_default_container_id">busybox:ubuntu-14.04</param> -->
</destination>
<!-- Jobs that hit the walltime on one destination can be automatically
+8
View File
@@ -413,7 +413,15 @@ class JobConfiguration( object ):
:returns: str -- id or tag representing the default.
"""
rval = parent.get('default')
if 'default_from_environ' in parent.attrib:
environ_var = parent.attrib['default_from_environ']
rval = os.environ.get(environ_var, rval)
elif 'default_from_config' in parent.attrib:
config_val = parent.attrib['default_from_config']
rval = self.app.config.config_dict.get(config_val, rval)
if rval is not None:
# If the parent element has a 'default' attribute, use the id or tag in that attribute
if rval not in names:
+8
View File
@@ -57,6 +57,14 @@ class CondorJobRunner( AsynchronousJobRunner ):
# get destination params
query_params = submission_params(prefix="", **job_destination.params)
container = None
universe = query_params.get('universe', False)
if universe.strip().lower() == 'docker':
container = self.find_container( job_wrapper )
if container:
# HTCondor needs the image as 'docker_image'
query_params.update({'docker_image': container})
galaxy_slots = query_params.get('request_cpus', None)
if galaxy_slots:
galaxy_slots_statement = 'GALAXY_SLOTS="%s"; export GALAXY_SLOTS_CONFIGURED="1"' % galaxy_slots
+5 -1
View File
@@ -107,7 +107,11 @@ class ContainerFinder(object):
def __default_container_id(self, container_type, destination_info):
if not self.__container_type_enabled(container_type, destination_info):
return None
return destination_info.get("%s_default_container_id" % container_type)
key = "%s_default_container_id" % container_type
# Also allow docker_image...
if key not in destination_info:
key = "%s_image" % container_type
return destination_info.get(key)
def __destination_container(self, container_id, container_type, tool_info, destination_info, job_info):
# TODO: ensure destination_info is dict-like