mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Introduces additional parameter to avoid having the command-line modified for kubernetes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user