mirror of
https://github.com/clearml/clearml-agent
synced 2025-03-16 00:07:15 +00:00
Fix sensitive environment variable values are not masked in "executing docker" printout (issue #67)
This commit is contained in:
parent
31d90be0a1
commit
db57441c5d
@ -673,7 +673,7 @@ class Worker(ServiceCommandSection):
|
|||||||
lines=
|
lines=
|
||||||
['Running Task {} inside {}docker: {} arguments: {}\n'.format(
|
['Running Task {} inside {}docker: {} arguments: {}\n'.format(
|
||||||
task_id, "default " if default_docker else '',
|
task_id, "default " if default_docker else '',
|
||||||
docker_image, docker_arguments or [])]
|
docker_image, self._sanitize_docker_command(docker_arguments or []))]
|
||||||
+ (['custom_setup_bash_script:\n{}'.format(docker_setup_script)] if docker_setup_script else []),
|
+ (['custom_setup_bash_script:\n{}'.format(docker_setup_script)] if docker_setup_script else []),
|
||||||
level="INFO",
|
level="INFO",
|
||||||
session=task_session,
|
session=task_session,
|
||||||
@ -1434,7 +1434,7 @@ class Worker(ServiceCommandSection):
|
|||||||
|
|
||||||
queue_names = [q.name for q in queues]
|
queue_names = [q.name for q in queues]
|
||||||
if not all('=' in q for q in queue_names):
|
if not all('=' in q for q in queue_names):
|
||||||
raise ValueError("using --dynamic-gpus, --queue [{}], "
|
raise ValueError("using --dynamic-gpus, --queues [{}], "
|
||||||
"queue must be in format <queue_name>=<num_gpus>".format(queue_names))
|
"queue must be in format <queue_name>=<num_gpus>".format(queue_names))
|
||||||
|
|
||||||
gpu_indexes = kwargs.get('gpus')
|
gpu_indexes = kwargs.get('gpus')
|
||||||
@ -1938,7 +1938,6 @@ class Worker(ServiceCommandSection):
|
|||||||
clone=False,
|
clone=False,
|
||||||
**_
|
**_
|
||||||
):
|
):
|
||||||
|
|
||||||
self._standalone_mode = standalone_mode
|
self._standalone_mode = standalone_mode
|
||||||
|
|
||||||
if not task_id:
|
if not task_id:
|
||||||
@ -2292,8 +2291,13 @@ class Worker(ServiceCommandSection):
|
|||||||
execution.working_dir
|
execution.working_dir
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
print("Executing task id [%s]:" % current_task.id)
|
print("Executing task id [%s]:" % current_task.id)
|
||||||
for pair in attr.asdict(execution).items():
|
sanitized_execution = attr.evolve(
|
||||||
|
execution,
|
||||||
|
docker_cmd=" ".join(self._sanitize_docker_command(shlex.split(execution.docker_cmd or ""))),
|
||||||
|
)
|
||||||
|
for pair in attr.asdict(sanitized_execution).items():
|
||||||
print("{} = {}".format(*pair))
|
print("{} = {}".format(*pair))
|
||||||
print()
|
print()
|
||||||
return execution
|
return execution
|
||||||
@ -2956,7 +2960,8 @@ class Worker(ServiceCommandSection):
|
|||||||
self._docker_arguments = docker_arguments
|
self._docker_arguments = docker_arguments
|
||||||
|
|
||||||
print("Running in Docker {} mode (v19.03 and above) - using default docker image: {} {}\n".format(
|
print("Running in Docker {} mode (v19.03 and above) - using default docker image: {} {}\n".format(
|
||||||
'*standalone*' if self._standalone_mode else '', self._docker_image, self._docker_arguments or ''))
|
'*standalone*' if self._standalone_mode else '', self._docker_image,
|
||||||
|
self._sanitize_docker_command(self._docker_arguments) or ''))
|
||||||
|
|
||||||
temp_config = deepcopy(self._session.config)
|
temp_config = deepcopy(self._session.config)
|
||||||
mounted_cache_dir = temp_config.get(
|
mounted_cache_dir = temp_config.get(
|
||||||
@ -3533,6 +3538,8 @@ class Worker(ServiceCommandSection):
|
|||||||
|
|
||||||
def _sanitize_docker_command(self, docker_command):
|
def _sanitize_docker_command(self, docker_command):
|
||||||
# type: (List[str]) -> List[str]
|
# type: (List[str]) -> List[str]
|
||||||
|
if not docker_command:
|
||||||
|
return docker_command
|
||||||
if not self._session.config.get('agent.hide_docker_command_env_vars.enabled', False):
|
if not self._session.config.get('agent.hide_docker_command_env_vars.enabled', False):
|
||||||
return docker_command
|
return docker_command
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ DAEMON_ARGS = dict({
|
|||||||
},
|
},
|
||||||
'--dynamic-gpus': {
|
'--dynamic-gpus': {
|
||||||
'help': 'Allow to dynamically allocate gpus based on queue properties, '
|
'help': 'Allow to dynamically allocate gpus based on queue properties, '
|
||||||
'configure with \'--queue <queue_name>=<num_gpus>\'.'
|
'configure with \'--queues <queue_name>=<num_gpus>\'.'
|
||||||
' Example: \'--dynamic-gpus --gpus 0-3 --queue dual_gpus=2 single_gpu=1\''
|
' Example: \'--dynamic-gpus --gpus 0-3 --queue dual_gpus=2 single_gpu=1\''
|
||||||
' Example Opportunistic: \'--dynamic-gpus --gpus 0-3 --queue dual_gpus=2 max_quad_gpus=1-4 \'',
|
' Example Opportunistic: \'--dynamic-gpus --gpus 0-3 --queue dual_gpus=2 max_quad_gpus=1-4 \'',
|
||||||
'action': 'store_true',
|
'action': 'store_true',
|
||||||
|
Loading…
Reference in New Issue
Block a user