From 6edc1b840c1ea04a96b8e966ec1051301adac9de Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Thu, 11 May 2023 16:04:09 +0300 Subject: [PATCH] Fix Task.query_tasks() fails with a None task_filter --- clearml/task.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clearml/task.py b/clearml/task.py index fcb78c55..5f756383 100644 --- a/clearml/task.py +++ b/clearml/task.py @@ -1032,19 +1032,18 @@ class Task(_Task): :return: The Tasks specified by the parameter combinations (see the parameters). """ + task_filter = task_filter or {} if tags: - task_filter = task_filter or {} task_filter['tags'] = (task_filter.get('tags') or []) + list(tags) return_fields = {} if additional_return_fields: - task_filter = task_filter or {} return_fields = set(list(additional_return_fields) + ['id']) task_filter['only_fields'] = (task_filter.get('only_fields') or []) + list(return_fields) if task_filter.get('type'): task_filter['type'] = [str(task_type) for task_type in task_filter['type']] - results = cls._query_tasks(project_name=project_name, task_name=task_name, **(task_filter or {})) + results = cls._query_tasks(project_name=project_name, task_name=task_name, **task_filter) return [t.id for t in results] if not additional_return_fields else \ [{k: cls._get_data_property(prop_path=k, data=r, raise_on_error=False, log_on_error=False) for k in return_fields}