Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTCondor Docker Integration #2278

Merged
merged 7 commits into from May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions config/job_conf.xml.sample_advanced
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lib/galaxy/jobs/__init__.py
Expand Up @@ -413,7 +413,15 @@ def __get_default(self, parent, names):

: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:
Expand Down
8 changes: 8 additions & 0 deletions lib/galaxy/jobs/runners/condor.py
Expand Up @@ -57,6 +57,14 @@ def queue_job( self, job_wrapper ):

# 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
Expand Down
6 changes: 5 additions & 1 deletion lib/galaxy/tools/deps/containers.py
Expand Up @@ -107,7 +107,11 @@ def __overridden_container_id(self, container_type, destination_info):
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
Expand Down