From bb4b79c1e8836b7be16064bea073a1e50dcaca93 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Fri, 2 Sep 2022 23:34:22 +0300 Subject: [PATCH] Fix artifacts and models use task original name and not new name --- clearml/backend_interface/task/task.py | 7 ++++--- clearml/binding/artifacts.py | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/clearml/backend_interface/task/task.py b/clearml/backend_interface/task/task.py index cbd9c449..bece2039 100644 --- a/clearml/backend_interface/task/task.py +++ b/clearml/backend_interface/task/task.py @@ -1517,9 +1517,10 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin): :param name: The name of the Task. :type name: str """ - name = name or '' - self._set_task_property("name", str(name)) - self._edit(name=self.data.name) + name = str(name) or "" + self._set_task_property("name", name) + self._edit(name=name) + self.data.name = name def set_parent(self, parent): # type: (Optional[Union[str, Task]]) -> () diff --git a/clearml/binding/artifacts.py b/clearml/binding/artifacts.py index e603aa68..0809f46f 100644 --- a/clearml/binding/artifacts.py +++ b/clearml/binding/artifacts.py @@ -311,6 +311,8 @@ class Artifacts(object): self._task_artifact_list = [] self._task_edit_lock = ForkSafeRLock() self._storage_prefix = None + self._task_name = None + self._project_name = None def register_artifact(self, name, artifact, metadata=None, uniqueness_columns=True): # type: (str, DataFrame, Optional[dict], Union[bool, Sequence[str]]) -> () @@ -999,7 +1001,9 @@ class Artifacts(object): def _get_storage_uri_prefix(self): # type: () -> str - if not self._storage_prefix: + if not self._storage_prefix or self._task_name != self._task.name or self._project_name != self._task.get_project_name(): # noinspection PyProtectedMember self._storage_prefix = self._task._get_output_destination_suffix() + self._task_name = self._task.name + self._project_name = self._task.get_project_name() return self._storage_prefix