mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-26 18:16:15 +00:00
PEP8
This commit is contained in:
parent
94fc0138b5
commit
bb9ad6b213
@ -480,7 +480,7 @@ def get_task_container(session, task_id, ignore_match_rules=False, allow_force_c
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
if not res.ok:
|
if not res.ok:
|
||||||
raise Exception("failed setting runtime property")
|
raise Exception("failed setting container property")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("WARNING: failed setting container properties for task '{}': {}".format(task_id, ex))
|
print("WARNING: failed setting container properties for task '{}': {}".format(task_id, ex))
|
||||||
|
|
||||||
@ -4705,7 +4705,7 @@ class Worker(ServiceCommandSection):
|
|||||||
docker_arguments = self._resolve_docker_env_args(docker_arguments)
|
docker_arguments = self._resolve_docker_env_args(docker_arguments)
|
||||||
|
|
||||||
if extra_docker_arguments:
|
if extra_docker_arguments:
|
||||||
# we always resolve environments in the `extra_docker_arguments` becuase the admin set them (not users)
|
# we always resolve environments in the `extra_docker_arguments` because the admin set them (not users)
|
||||||
extra_docker_arguments = self._resolve_docker_env_args(extra_docker_arguments)
|
extra_docker_arguments = self._resolve_docker_env_args(extra_docker_arguments)
|
||||||
extra_docker_arguments = [extra_docker_arguments] \
|
extra_docker_arguments = [extra_docker_arguments] \
|
||||||
if isinstance(extra_docker_arguments, six.string_types) else extra_docker_arguments
|
if isinstance(extra_docker_arguments, six.string_types) else extra_docker_arguments
|
||||||
|
@ -196,7 +196,7 @@ class DockerArgsSanitizer:
|
|||||||
(i.e. changing the ports if needed and adding the new env var), runtime property
|
(i.e. changing the ports if needed and adding the new env var), runtime property
|
||||||
"""
|
"""
|
||||||
if not docker_arguments:
|
if not docker_arguments:
|
||||||
return
|
return None
|
||||||
# make a copy we are going to change it
|
# make a copy we are going to change it
|
||||||
docker_arguments = docker_arguments[:]
|
docker_arguments = docker_arguments[:]
|
||||||
port_mapping_filtered = [
|
port_mapping_filtered = [
|
||||||
@ -205,7 +205,7 @@ class DockerArgsSanitizer:
|
|||||||
]
|
]
|
||||||
|
|
||||||
if not port_mapping_filtered:
|
if not port_mapping_filtered:
|
||||||
return
|
return None
|
||||||
|
|
||||||
# test if network=host was requested, docker will ignore published ports anyhow, so no use in parsing them
|
# test if network=host was requested, docker will ignore published ports anyhow, so no use in parsing them
|
||||||
network_filtered = DockerArgsSanitizer.filter_switches(
|
network_filtered = DockerArgsSanitizer.filter_switches(
|
||||||
@ -213,7 +213,7 @@ class DockerArgsSanitizer:
|
|||||||
network_filtered = [t for t in network_filtered if t.strip == "host" or "host" in t.split("=")]
|
network_filtered = [t for t in network_filtered if t.strip == "host" or "host" in t.split("=")]
|
||||||
# if any network is configured, we ignore it, there is nothing we can do
|
# if any network is configured, we ignore it, there is nothing we can do
|
||||||
if network_filtered:
|
if network_filtered:
|
||||||
return
|
return None
|
||||||
|
|
||||||
# verifying available ports, remapping if necessary
|
# verifying available ports, remapping if necessary
|
||||||
port_checks = TcpPorts()
|
port_checks = TcpPorts()
|
||||||
|
@ -89,9 +89,9 @@ def kill_all_child_processes(pid=None, include_parent=True):
|
|||||||
print("\nLeaving process id {}".format(pid))
|
print("\nLeaving process id {}".format(pid))
|
||||||
try:
|
try:
|
||||||
parent = psutil.Process(pid)
|
parent = psutil.Process(pid)
|
||||||
except psutil.Error:
|
except psutil.Error as ex:
|
||||||
# could not find parent process id
|
# could not find process id
|
||||||
print("ERROR: could not find parent process id {}".format(pid))
|
print("ERROR: could not find process id {}: {}".format(pid, ex))
|
||||||
return
|
return
|
||||||
for child in parent.children(recursive=True):
|
for child in parent.children(recursive=True):
|
||||||
try:
|
try:
|
||||||
@ -113,7 +113,7 @@ def terminate_all_child_processes(pid=None, timeout=10., include_parent=True):
|
|||||||
try:
|
try:
|
||||||
parent = psutil.Process(pid)
|
parent = psutil.Process(pid)
|
||||||
except psutil.Error:
|
except psutil.Error:
|
||||||
# could not find parent process id
|
# could not find process id
|
||||||
return
|
return
|
||||||
for child in parent.children(recursive=False):
|
for child in parent.children(recursive=False):
|
||||||
print('Terminating child process {}'.format(child.pid))
|
print('Terminating child process {}'.format(child.pid))
|
||||||
|
Loading…
Reference in New Issue
Block a user