Improve warning, PEP8

This commit is contained in:
allegroai 2022-05-30 19:48:34 +03:00
parent 23c6ec6643
commit 28eac2e043
2 changed files with 10 additions and 8 deletions

View File

@ -2101,7 +2101,8 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
if kwargs and all(k in ('name', 'comment', 'tags', 'system_tags', 'runtime') for k in kwargs.keys()): if kwargs and all(k in ('name', 'comment', 'tags', 'system_tags', 'runtime') for k in kwargs.keys()):
pass pass
else: else:
raise ValueError('Task object can only be updated if created or in_progress') raise ValueError('Task object can only be updated if created or in_progress '
'[status={} fields={}]'.format(status, list(kwargs.keys())))
res = self.send(tasks.EditRequest(task=self.id, force=True, **kwargs), raise_on_errors=False) res = self.send(tasks.EditRequest(task=self.id, force=True, **kwargs), raise_on_errors=False)
return res return res

View File

@ -631,8 +631,8 @@ class Task(_Task):
def should_connect(*keys): def should_connect(*keys):
""" """
Evaluates value of auto_connect_frameworks[keys[0]]...[keys[-1]]. Evaluates value of auto_connect_frameworks[keys[0]]...[keys[-1]].
If at some point in the evaluation, the value of auto_connect_frameworks[keys[0]]...[keys[-1]] is a bool, If at some point in the evaluation, the value of auto_connect_frameworks[keys[0]]...[keys[-1]]
that value will be returned. If a dictionary is empty, it will be evaluated to False. is a bool, that value will be returned. If a dictionary is empty, it will be evaluated to False.
If a key will not be found in the current dictionary, True will be returned. If a key will not be found in the current dictionary, True will be returned.
""" """
should_bind_framework = auto_connect_frameworks should_bind_framework = auto_connect_frameworks
@ -948,8 +948,8 @@ class Task(_Task):
`parent`: (str) filter by parent task-id matching `parent`: (str) filter by parent task-id matching
`search_text`: (str) free text search (in task fields comment/name/id) `search_text`: (str) free text search (in task fields comment/name/id)
`status`: List[str] List of valid statuses `status`: List[str] List of valid statuses
(options are: "created", "queued", "in_progress", "stopped", "published", "publishing", "closed", "failed", (options are: "created", "queued", "in_progress", "stopped", "published", "publishing", "closed",
"completed", "unknown") "failed", "completed", "unknown")
`type`: List[str] List of valid task type `type`: List[str] List of valid task type
(options are: 'training', 'testing', 'inference', 'data_processing', 'application', 'monitor', (options are: 'training', 'testing', 'inference', 'data_processing', 'application', 'monitor',
'controller', 'optimizer', 'service', 'qc'. 'custom') 'controller', 'optimizer', 'service', 'qc'. 'custom')
@ -1008,8 +1008,8 @@ class Task(_Task):
`parent`: (str) filter by parent task-id matching `parent`: (str) filter by parent task-id matching
`search_text`: (str) free text search (in task fields comment/name/id) `search_text`: (str) free text search (in task fields comment/name/id)
`status`: List[str] List of valid statuses `status`: List[str] List of valid statuses
(options are: "created", "queued", "in_progress", "stopped", "published", "publishing", "closed", "failed", (options are: "created", "queued", "in_progress", "stopped", "published", "publishing", "closed",
"completed", "unknown") "failed", "completed", "unknown")
`type`: List[str] List of valid task type `type`: List[str] List of valid task type
(options are: 'training', 'testing', 'inference', 'data_processing', 'application', 'monitor', (options are: 'training', 'testing', 'inference', 'data_processing', 'application', 'monitor',
'controller', 'optimizer', 'service', 'qc'. 'custom') 'controller', 'optimizer', 'service', 'qc'. 'custom')
@ -3371,8 +3371,8 @@ class Task(_Task):
is_sub_process = self.__is_subprocess() is_sub_process = self.__is_subprocess()
# noinspection PyBroadException
task_status = None task_status = None
# noinspection PyBroadException
try: try:
wait_for_uploads = True wait_for_uploads = True
# first thing mark task as stopped, so we will not end up with "running" on lost tasks # first thing mark task as stopped, so we will not end up with "running" on lost tasks
@ -3681,6 +3681,7 @@ class Task(_Task):
def _remove_at_exit_callbacks(self): def _remove_at_exit_callbacks(self):
self.__register_at_exit(None, only_remove_signal_and_exception_hooks=True) self.__register_at_exit(None, only_remove_signal_and_exception_hooks=True)
# noinspection PyProtectedMember
atexit.unregister(self.__exit_hook._exit_callback) atexit.unregister(self.__exit_hook._exit_callback)
self._at_exit_called = True self._at_exit_called = True