Skip to content

Commit

Permalink
Introduces additional parameter to avoid having the command-line modi…
Browse files Browse the repository at this point in the history
…fied for kubernetes.
  • Loading branch information
pcm32 committed May 20, 2016
1 parent 4a90814 commit c7929f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/galaxy/jobs/command_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def build_command(
runner,
job_wrapper,
container=None,
modify_command_for_container=True,
include_metadata=False,
include_work_dir_outputs=True,
create_tool_working_directory=True,
Expand Down Expand Up @@ -57,14 +58,14 @@ def build_command(
if not container:
__handle_dependency_resolution(commands_builder, job_wrapper, remote_command_params)

if container or job_wrapper.commands_in_new_shell:
if container:
if (container and modify_command_for_container) or job_wrapper.commands_in_new_shell:
if container and modify_command_for_container:
# Many Docker containers do not have /bin/bash.
external_command_shell = "/bin/sh"
else:
external_command_shell = shell
externalized_commands = __externalize_commands(job_wrapper, external_command_shell, commands_builder, remote_command_params)
if container:
if container and modify_command_for_container:
# Stop now and build command before handling metadata and copying
# working directory files back. These should always happen outside
# of docker container - no security implications when generating
Expand Down
8 changes: 6 additions & 2 deletions lib/galaxy/jobs/runners/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def parse_destination_params(self, params):
"""
raise NotImplementedError()

def prepare_job(self, job_wrapper, include_metadata=False, include_work_dir_outputs=True):
def prepare_job(self, job_wrapper, include_metadata=False, include_work_dir_outputs=True,
modify_command_for_container=True):
"""Some sanity checks that all runners' queue_job() methods are likely to want to do
"""
job_id = job_wrapper.get_id_tag()
Expand All @@ -171,6 +172,7 @@ def prepare_job(self, job_wrapper, include_metadata=False, include_work_dir_outp
job_wrapper,
include_metadata=include_metadata,
include_work_dir_outputs=include_work_dir_outputs,
modify_command_for_container=modify_command_for_container
)
except Exception as e:
log.exception("(%s) Failure preparing job" % job_id)
Expand All @@ -193,13 +195,15 @@ def stop_job(self, job):
def recover(self, job, job_wrapper):
raise NotImplementedError()

def build_command_line( self, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
def build_command_line( self, job_wrapper, include_metadata=False, include_work_dir_outputs=True,
modify_command_for_container=True ):
container = self._find_container( job_wrapper )
return build_command(
self,
job_wrapper,
include_metadata=include_metadata,
include_work_dir_outputs=include_work_dir_outputs,
modify_command_for_container=modify_command_for_container,
container=container
)

Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/jobs/runners/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def queue_job(self, job_wrapper):
# prepare the job
# We currently don't need to include_metadata or include_work_dir_outputs, as working directory is the same
# were galaxy will expect results.
if not self.prepare_job(job_wrapper, include_metadata=False, include_work_dir_outputs=False):
log.debug("Starting queue_job for job " + job_wrapper.get_id_tag())
if not self.prepare_job(job_wrapper, include_metadata=False, include_work_dir_outputs=False,
modify_command_for_container=False):
return

job_destination = job_wrapper.job_destination
Expand Down

0 comments on commit c7929f8

Please sign in to comment.