From cb4e63515adb83a756b05883cc6f625dcb884c98 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Mon, 20 May 2024 15:55:12 +0300 Subject: [PATCH] Delete old sessions after SSH connection established only if restoring a workspace, otherwise delete at setup time --- clearml_session/__main__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/clearml_session/__main__.py b/clearml_session/__main__.py index 628fb5a..bd2e39e 100644 --- a/clearml_session/__main__.py +++ b/clearml_session/__main__.py @@ -1492,9 +1492,12 @@ def cli(): # ask user final approval ask_launch(args) - # remove old Tasks created by us. - # (now we do it Only after a successful remote session) - delete_old_tasks_callback = partial(delete_old_tasks, state, client, state.get('base_task_id')) + # remove old Tasks created by us, unless we have to restore workspace, + if state.get("store_workspace") or state.get("continue_session"): + # then we do it Only after a successful remote session + delete_old_tasks_callback = partial(delete_old_tasks, state, client, state.get('base_task_id')) + else: + delete_old_tasks(state, client, state.get('base_task_id')) # Clone the Task and adjust parameters task = clone_task(state)