mirror of
https://github.com/clearml/clearml
synced 2025-02-12 15:45:25 +00:00
Fix reusing task after its project was deleted (issue #274)
This commit is contained in:
parent
78e892f337
commit
504dfd8f32
@ -3245,13 +3245,19 @@ class Task(_Task):
|
|||||||
if not task_id:
|
if not task_id:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
task = cls.__get_task_api_obj(task_id, ('id', 'name', 'project', 'type'))
|
task = cls.__get_task_api_obj(task_id, ('id', 'name', 'project', 'type'))
|
||||||
|
except Exception:
|
||||||
|
task = None
|
||||||
|
|
||||||
if task is None:
|
if task is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
project_name = None
|
project_name = None
|
||||||
if task.project:
|
if task.project:
|
||||||
|
# noinspection PyBroadException
|
||||||
|
try:
|
||||||
project = cls._send(
|
project = cls._send(
|
||||||
cls._get_default_session(),
|
cls._get_default_session(),
|
||||||
projects.GetByIdRequest(project=task.project)
|
projects.GetByIdRequest(project=task.project)
|
||||||
@ -3259,6 +3265,8 @@ class Task(_Task):
|
|||||||
|
|
||||||
if project:
|
if project:
|
||||||
project_name = project.name
|
project_name = project.name
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
if task_data.get('type') and \
|
if task_data.get('type') and \
|
||||||
task_data.get('type') not in (cls.TaskTypes.training, cls.TaskTypes.testing) and \
|
task_data.get('type') not in (cls.TaskTypes.training, cls.TaskTypes.testing) and \
|
||||||
|
Loading…
Reference in New Issue
Block a user