mirror of
				https://github.com/clearml/clearml
				synced 2025-06-26 18:16:07 +00:00 
			
		
		
		
	Fix project "default_upload_destination" is used (#734)
This commit is contained in:
		
							parent
							
								
									bb4b79c1e8
								
							
						
					
					
						commit
						495741df0a
					
				| @ -181,6 +181,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin): | ||||
|             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 | ||||
| @ -546,6 +547,8 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin): | ||||
|                             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 | ||||
| 
 | ||||
| @ -1481,6 +1484,20 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin): | ||||
|         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") | ||||
|  | ||||
| @ -597,6 +597,8 @@ class Task(_Task): | ||||
|                         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 | ||||
| @ -612,6 +614,8 @@ class Task(_Task): | ||||
|                         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 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 allegroai
						allegroai