Skip to content

Commit

Permalink
Add original_task property to models
Browse files Browse the repository at this point in the history
Change `task` property to return connected task
  • Loading branch information
allegroai committed Jul 21, 2024
1 parent a59b402 commit fa0ba10
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions clearml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,22 @@ def labels(self):
def task(self):
# type: () -> str
"""
Return the creating task ID
Return the task ID connected to this model. If not task is connected,
return the ID of the task that originally created this model.
:return: The Task ID (str)
"""
return self._task.id if self._task else self._get_base_model().task
return self._task.id if self._task else self.original_task

@property
def original_task(self):
# type: () -> str
"""
Return the ID of the task that created this model.
:return: The Task ID (str)
"""
return self._get_base_model().task

@property
def url(self):
Expand Down

0 comments on commit fa0ba10

Please sign in to comment.