mirror of
https://github.com/clearml/clearml
synced 2025-03-03 18:52:12 +00:00
Fix Task.query_tasks()
returns all tasks when a non-existent project name is provided
This commit is contained in:
parent
bd53d44d71
commit
64e00716e1
@ -1089,15 +1089,32 @@ class Task(_Task):
|
|||||||
@property
|
@property
|
||||||
def output_uri(self):
|
def output_uri(self):
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
|
"""
|
||||||
|
The storage / output url for this task. This is the default location for output models and other artifacts.
|
||||||
|
|
||||||
|
:return: The url string.
|
||||||
|
"""
|
||||||
return self.storage_uri
|
return self.storage_uri
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def last_worker(self):
|
def last_worker(self):
|
||||||
|
# type: () -> str
|
||||||
|
"""
|
||||||
|
ID of last worker that handled the task.
|
||||||
|
|
||||||
|
:return: The worker ID.
|
||||||
|
"""
|
||||||
return self._data.last_worker
|
return self._data.last_worker
|
||||||
|
|
||||||
@output_uri.setter
|
@output_uri.setter
|
||||||
def output_uri(self, value):
|
def output_uri(self, value):
|
||||||
# type: (Union[str, bool]) -> None
|
# type: (Union[str, bool]) -> None
|
||||||
|
"""
|
||||||
|
Set the storage / output url for this task. This is the default location for output models and other artifacts.
|
||||||
|
|
||||||
|
:param str/bool value: The value to set for output URI. Can be either a bucket link, True for default server
|
||||||
|
or False. Check Task.init reference docs for more info (output_uri is a parameter).
|
||||||
|
"""
|
||||||
|
|
||||||
# check if this is boolean
|
# check if this is boolean
|
||||||
if value is False:
|
if value is False:
|
||||||
@ -4030,6 +4047,7 @@ class Task(_Task):
|
|||||||
project_names = project_name
|
project_names = project_name
|
||||||
|
|
||||||
project_ids = []
|
project_ids = []
|
||||||
|
projects_not_found = []
|
||||||
if project_names:
|
if project_names:
|
||||||
for name in project_names:
|
for name in project_names:
|
||||||
aux_kwargs = {}
|
aux_kwargs = {}
|
||||||
@ -4045,6 +4063,16 @@ class Task(_Task):
|
|||||||
)
|
)
|
||||||
if res.response and res.response.projects:
|
if res.response and res.response.projects:
|
||||||
project_ids.extend([project.id for project in res.response.projects])
|
project_ids.extend([project.id for project in res.response.projects])
|
||||||
|
else:
|
||||||
|
projects_not_found.append(name)
|
||||||
|
if projects_not_found:
|
||||||
|
# If any of the given project names does not exist, fire off a warning
|
||||||
|
LoggerRoot.get_base_logger().warning(
|
||||||
|
"No projects were found with name(s): {}".format(", ".join(projects_not_found))
|
||||||
|
)
|
||||||
|
if not project_ids:
|
||||||
|
# If not a single project exists or was found, return empty right away
|
||||||
|
return []
|
||||||
|
|
||||||
session = cls._get_default_session()
|
session = cls._get_default_session()
|
||||||
system_tags = 'system_tags' if hasattr(tasks.Task, 'system_tags') else 'tags'
|
system_tags = 'system_tags' if hasattr(tasks.Task, 'system_tags') else 'tags'
|
||||||
|
Loading…
Reference in New Issue
Block a user