Skip to content

Commit

Permalink
Fix project "default_upload_destination" is used (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
allegroai committed Sep 2, 2022
1 parent bb4b79c commit 495741d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions clearml/backend_interface/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def __init__(self, session=None, task_id=None, log=None, project_name=None,
raise ValueError("Task ID \"{}\" could not be found".format(self.id))

self._project_name = (self.project, project_name)
self._project_object = None

if running_remotely() or DevWorker.report_stdout:
log_to_backend = False
Expand Down Expand Up @@ -546,6 +547,8 @@ def _reload(self):
setattr(stored_data, k, v)
if stored_dict.get('project_name'):
self._project_name = (None, stored_dict.get('project_name'))
if stored_dict.get('project_object'):
self._project_object = (None, stored_dict.get('project_object'))
except Exception:
stored_data = self._data

Expand Down Expand Up @@ -1481,6 +1484,20 @@ def get_project_name(self):
self._project_name = (self.project, res.response.project.name)
return self._project_name[1]

def get_project_object(self):
# type: () -> dict
if self.project is None:
return self._project_object[1] if self._project_object and len(self._project_object) > 1 else None

if self._project_object and self._project_object[1] is not None and self._project_object[0] == self.project:
return self._project_object[1]

res = self.send(projects.GetByIdRequest(project=self.project), raise_on_errors=False)
if not res or not res.response or not res.response.project:
return {}
self._project_object = (self.project, res.response.project)
return self._project_object[1]

def get_tags(self):
# type: () -> Sequence[str]
return self._get_task_property("tags")
Expand Down
4 changes: 4 additions & 0 deletions clearml/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,8 @@ def completed_cb(x):
task.output_uri = None
elif output_uri:
task.output_uri = output_uri
elif task.get_project_object().default_output_destination:
task.output_uri = task.get_project_object().default_output_destination
elif cls.__default_output_uri:
task.output_uri = cls.__default_output_uri
# store new task ID
Expand All @@ -612,6 +614,8 @@ def completed_cb(x):
task_id=get_remote_task_id(),
log_to_backend=False,
)
if task.get_project_object().default_output_destination and not task.output_uri:
task.output_uri = task.get_project_object().default_output_destination
if cls.__default_output_uri and not task.output_uri:
task.output_uri = cls.__default_output_uri
# store new task ID
Expand Down

0 comments on commit 495741d

Please sign in to comment.