Fix artifact preview limit 64kb

This commit is contained in:
allegroai 2021-03-06 01:28:33 +02:00
parent 0f65d6345d
commit 41cad87b77

View File

@ -514,6 +514,12 @@ class Artifacts(object):
else: else:
raise ValueError("Artifact type {} not supported".format(type(artifact_object))) 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 # remove from existing list, if exists
for artifact in self._task_artifact_list: for artifact in self._task_artifact_list:
if artifact.key == name: if artifact.key == name: