mirror of
https://github.com/clearml/clearml
synced 2025-05-09 15:10:38 +00:00
Clean up exception handeling in cleanup_service.py (#1387)
* cleaned up exception handeling in cleanup_service.py * added general exception for edge cases removed obsolete comment --------- Co-authored-by: Soeren Herrmann <soeren-faustus.herrmann@schott.org>
This commit is contained in:
parent
0204fba918
commit
bd2adaa9ca
@ -79,15 +79,24 @@ while True:
|
|||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
deleted_task = Task.get_task(task_id=task.id)
|
deleted_task = Task.get_task(task_id=task.id)
|
||||||
deleted_task.delete(
|
if deleted_task.delete(
|
||||||
delete_artifacts_and_models=True,
|
delete_artifacts_and_models=True,
|
||||||
skip_models_used_by_other_tasks=True,
|
skip_models_used_by_other_tasks=True,
|
||||||
raise_on_error=False
|
raise_on_error=False
|
||||||
)
|
):
|
||||||
except Exception as ex:
|
logging.info(f'successfully deleted task with id {task.id}')
|
||||||
|
else:
|
||||||
|
logging.warning(f'could not delete task with id {task.id}')
|
||||||
|
except ValueError as e:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
"Could not delete Task ID={}, {}".format(
|
"Could not find Task ID={}, {}".format(
|
||||||
task.id, ex.message if hasattr(ex, "message") else ex
|
task.id, e.message if hasattr(e, "message") else e
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logging.warning(
|
||||||
|
"Error while deleting Task ID={}, {}".format(
|
||||||
|
task.id, e.message if hasattr(e, "message") else e
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user