From 249498aa5e4503bd87fe58be9d3d8a6376505a9a Mon Sep 17 00:00:00 2001
From: Theodore Chang <theodore.chang@physik.hu-berlin.de>
Date: Sat, 24 Aug 2024 20:27:45 +0000
Subject: [PATCH] Change default value of size limit

---
 nomad/archive/converter.py | 14 +++++++-------
 nomad/cli/admin/uploads.py |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/nomad/archive/converter.py b/nomad/archive/converter.py
index 77e2cf944e..4b672f67a6 100644
--- a/nomad/archive/converter.py
+++ b/nomad/archive/converter.py
@@ -58,7 +58,7 @@ def convert_archive(
     delete_old: bool = False,
     counter: Counter = None,
     force_repack: bool = False,
-    size_limit: int = 4,
+    size_limit: int = -1,
 ):
     """
     Convert an archive of the old format to the new format.
@@ -84,7 +84,7 @@ def convert_archive(
         delete_old (bool, optional): Whether to delete the old file after conversion. Defaults to False.
         counter (Counter, optional): A counter to track the progress of the conversion. Defaults to None.
         force_repack (bool, optional): Force repacking the archive that is already in the new format. Defaults to False.
-        size_limit (int, optional): The size limit in GB for the archive. Defaults to 4.
+        size_limit (int, optional): The size limit in GB for the archive. Defaults to -1 (no limit).
     """
     prefix: str = counter.increment() if counter else ''
 
@@ -114,7 +114,7 @@ def convert_archive(
         return
 
     original_size = os.path.getsize(original_path)
-    if original_size > size_limit * 1024**3:
+    if size_limit > 0 and original_size > size_limit * 1024**3:
         flush(
             f'{prefix} [WARNING] File size exceeds limit {size_limit} GB: {original_path}'
         )
@@ -174,7 +174,7 @@ def convert_folder(
     overwrite: bool = False,
     delete_old: bool = False,
     force_repack: bool = False,
-    size_limit: int = 4,
+    size_limit: int = -1,
 ):
     """
     Convert archives in the specified folder to the new format using parallel processing.
@@ -191,7 +191,7 @@ def convert_folder(
         overwrite (bool): Whether to overwrite existing files (default is False).
         delete_old (bool): Whether to delete the old file after conversion (default is False).
         force_repack (bool): Force repacking the archive (default is False).
-        size_limit (int): Size limit in GB for the archive (default is 4).
+        size_limit (int): Size limit in GB for the archive (default is -1, no limit).
     """
     file_list: list = []
 
@@ -254,7 +254,7 @@ def convert_upload(
     overwrite: bool = False,
     delete_old: bool = False,
     force_repack: bool = False,
-    size_limit: int = 4,
+    size_limit: int = -1,
 ):
     """
     Function to convert an upload with the given upload_id to the new format.
@@ -271,7 +271,7 @@ def convert_upload(
         overwrite (bool, optional): Whether to overwrite existing files. Defaults to False.
         delete_old (bool, optional): Whether to delete the old file after conversion. Defaults to False.
         force_repack (bool, optional): Force repacking the existing archive (in new format). Defaults to False.
-        size_limit (int, optional): Size limit in GB for the archive. Defaults to 4.
+        size_limit (int, optional): Size limit in GB for the archive. Defaults to -1 (no limit).
     """
     if isinstance(uploads, (str, Upload)):
         uploads = [uploads]
diff --git a/nomad/cli/admin/uploads.py b/nomad/cli/admin/uploads.py
index 20d8bc930e..f3c1c8b35f 100644
--- a/nomad/cli/admin/uploads.py
+++ b/nomad/cli/admin/uploads.py
@@ -1450,8 +1450,8 @@ def only_v1(path: str):
     '--size-limit',
     '-s',
     type=int,
-    default=4,
-    help='Limit archive size in GB. Default is 4GB.',
+    default=-1,
+    help='Only handle archives under limited size in GB. Default is -1 (no limit).',
 )
 @click.pass_context
 def convert_archive(
-- 
GitLab