mirror of
https://github.com/clearml/clearml-agent
synced 2025-02-07 13:26:08 +00:00
Add agent.disable_task_docker_override
configuration option to disable docker override specified in executing tasks
This commit is contained in:
parent
6be75abc86
commit
5d517c91b5
@ -332,4 +332,9 @@
|
|||||||
# the agent will catch the exception, log it and continue running.
|
# the agent will catch the exception, log it and continue running.
|
||||||
# Set this to `true` to propagate exceptions and crash the agent.
|
# Set this to `true` to propagate exceptions and crash the agent.
|
||||||
# crash_on_exception: true
|
# crash_on_exception: true
|
||||||
|
|
||||||
|
# Disable task docker override. If true, the agent will use the default docker image and ignore any docker image
|
||||||
|
# and arguments specified in the task's container section (setup shell script from the task container section will
|
||||||
|
# be used in any case, of specified).
|
||||||
|
disable_task_docker_override: false
|
||||||
}
|
}
|
||||||
|
@ -737,7 +737,7 @@ class Worker(ServiceCommandSection):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def run_one_task(self, queue, task_id, worker_args, docker=None, task_session=None):
|
def run_one_task(self, queue, task_id, worker_args, docker=None, task_session=None):
|
||||||
# type: (Text, Text, WorkerParams, Optional[Text]) -> int
|
# type: (Text, Text, WorkerParams, Optional[Text], Optional[Session]) -> int
|
||||||
"""
|
"""
|
||||||
Run one task pulled from queue.
|
Run one task pulled from queue.
|
||||||
:param queue: ID of queue that task was pulled from
|
:param queue: ID of queue that task was pulled from
|
||||||
@ -782,10 +782,18 @@ class Worker(ServiceCommandSection):
|
|||||||
except Exception:
|
except Exception:
|
||||||
task_container = {}
|
task_container = {}
|
||||||
|
|
||||||
default_docker = not bool(task_container.get('image'))
|
default_docker = (
|
||||||
docker_image = task_container.get('image') or self._docker_image
|
self._session.config.get('agent.disable_task_docker_override', False)
|
||||||
docker_arguments = task_container.get(
|
or not bool(task_container.get('image'))
|
||||||
'arguments', self._docker_arguments if default_docker else None)
|
)
|
||||||
|
if default_docker:
|
||||||
|
docker_image = self._docker_image
|
||||||
|
docker_arguments = self._docker_arguments
|
||||||
|
else:
|
||||||
|
docker_image = task_container.get('image') or self._docker_image
|
||||||
|
docker_arguments = task_container.get(
|
||||||
|
'arguments', self._docker_arguments if default_docker else None)
|
||||||
|
|
||||||
docker_setup_script = task_container.get('setup_shell_script')
|
docker_setup_script = task_container.get('setup_shell_script')
|
||||||
|
|
||||||
self.send_logs(
|
self.send_logs(
|
||||||
@ -2079,7 +2087,10 @@ class Worker(ServiceCommandSection):
|
|||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
task_container = get_task_container(self._session, task_id)
|
task_container = get_task_container(self._session, task_id)
|
||||||
if task_container.get('image'):
|
if (
|
||||||
|
task_container.get('image')
|
||||||
|
and not self._session.config.get('agent.disable_task_docker_override', False)
|
||||||
|
):
|
||||||
docker_image = task_container.get('image')
|
docker_image = task_container.get('image')
|
||||||
print('Ignoring default docker image, using task docker image {}'.format(docker_image))
|
print('Ignoring default docker image, using task docker image {}'.format(docker_image))
|
||||||
docker_arguments = task_container.get('arguments')
|
docker_arguments = task_container.get('arguments')
|
||||||
|
Loading…
Reference in New Issue
Block a user