Introduces additional parameter to avoid having the command-line modified for kubernetes.

This commit is contained in:
Pablo Moreno
2016-05-20 19:20:45 +01:00
parent 4a908141e3
commit c7929f882e
3 changed files with 13 additions and 6 deletions
+4 -3
View File
@@ -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,
@@ -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
+6 -2
View File
@@ -145,7 +145,8 @@ class BaseJobRunner( object ):
"""
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()
@@ -171,6 +172,7 @@ class BaseJobRunner( object ):
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)
@@ -193,13 +195,15 @@ class BaseJobRunner( object ):
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
)
+3 -1
View File
@@ -64,7 +64,9 @@ class KubernetesJobRunner(AsynchronousJobRunner):
# 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