From c09c2c170d04bdadb34953e7f552a583a42b85e5 Mon Sep 17 00:00:00 2001 From: clearml <> Date: Sun, 20 Apr 2025 15:55:36 +0300 Subject: [PATCH] Improve printouts --- clearml_session/interactive_session_task.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/clearml_session/interactive_session_task.py b/clearml_session/interactive_session_task.py index 6ccd30c..bbd2e5a 100644 --- a/clearml_session/interactive_session_task.py +++ b/clearml_session/interactive_session_task.py @@ -1144,11 +1144,16 @@ def _sync_workspace_snapshot(task, param, auto_shutdown_task): files_desc += "{}: {}[{}]\n".format(f.absolute(), fs.st_size, fs.st_mtime) workspace_hash = hash(str(files_desc)) if param.get("workspace_hash") == workspace_hash: - print("Skipping workspace snapshot upload, " - "already uploaded no files changed since last sync {}".format(param.get(sync_runtime_property))) - return + # noinspection PyPackageRequirements + try: + time_stamp = datetime.datetime.fromtimestamp( + param.get(sync_runtime_property)).strftime('%Y-%m-%d %H:%M:%S') + except Exception: + time_stamp = param.get(sync_runtime_property) - print("Uploading workspace: {}".format(workspace_folder)) + print("Skipping workspace snapshot upload, " + "already uploaded no files changed since last sync {}".format(time_stamp)) + return # force running status - so that we can upload the artifact prev_status = task.status @@ -1156,6 +1161,8 @@ def _sync_workspace_snapshot(task, param, auto_shutdown_task): task.mark_started(force=True) try: + print("Compressing workspace: {}".format(workspace_folder)) + # create a tar file of the folder # put a consistent file name into a temp folder because the filename is part of # the compressed artifact, and we want consistency in hash. @@ -1177,6 +1184,8 @@ def _sync_workspace_snapshot(task, param, auto_shutdown_task): relative_file_name = filename.relative_to(workspace_folder) archive_preview += '{} - {:,} B\n'.format(relative_file_name, filename.stat().st_size) + print("Uploading workspace: {}".format(workspace_folder)) + # upload actual snapshot tgz timestamp = datetime.datetime.now(datetime.UTC) \ if hasattr(datetime, "UTC") and hasattr(datetime.datetime, "now") else datetime.datetime.utcnow()