From 41cad87b77debfd3681631ea0a228c11be1eda39 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Sat, 6 Mar 2021 01:28:33 +0200 Subject: [PATCH] Fix artifact preview limit 64kb --- clearml/binding/artifacts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clearml/binding/artifacts.py b/clearml/binding/artifacts.py index 0ea68419..3bbf9995 100644 --- a/clearml/binding/artifacts.py +++ b/clearml/binding/artifacts.py @@ -514,6 +514,12 @@ class Artifacts(object): else: raise ValueError("Artifact type {} not supported".format(type(artifact_object))) + # verify preview not out of scope: + if artifact_type_data.preview and len(artifact_type_data.preview) > (self.max_preview_size_bytes+1024): + artifact_type_data.preview = '# full preview too large to store, storing first {}kb\n{}'.format( + self.max_preview_size_bytes // 1024, artifact_type_data.preview[:self.max_preview_size_bytes] + ) + # remove from existing list, if exists for artifact in self._task_artifact_list: if artifact.key == name: