4141from bencher .utils import params_to_str
4242from bencher .sample_order import SampleOrder
4343
44+ # Default cache size for benchmark results (100 GB)
45+ DEFAULT_CACHE_SIZE_BYTES = int (100e9 )
46+
4447# Customize the formatter
4548formatter = logging .Formatter ("%(levelname)s: %(message)s" )
4649logging .basicConfig (level = logging .INFO , format = "%(levelname)s %(message)s" )
@@ -157,15 +160,15 @@ def __init__(
157160 If None, a new report will be created. Defaults to None.
158161
159162 Raises:
160- AssertionError : If bench_name is not a string.
163+ TypeError : If bench_name is not a string.
161164 RuntimeError: If worker is a class type instead of an instance.
162165 """
163- assert isinstance (bench_name , str )
166+ if not isinstance (bench_name , str ):
167+ raise TypeError (f"bench_name must be a string, got { type (bench_name ).__name__ } " )
164168 self .bench_name = bench_name
165169 self .worker = None
166170 self .worker_class_instance = None
167171 self .worker_input_cfg = None
168- self .worker_class_instance = None
169172 self .set_worker (worker , worker_input_cfg )
170173 self .run_cfg = run_cfg
171174 if report is None :
@@ -181,7 +184,7 @@ def __init__(
181184 self .sample_cache = None # store the results of each benchmark function call in a cache
182185 self .ds_dynamic = {} # A dictionary to store unstructured vector datasets
183186
184- self .cache_size = int ( 100e9 ) # default to 100gb
187+ self .cache_size = DEFAULT_CACHE_SIZE_BYTES
185188
186189 # self.bench_cfg = BenchCfg()
187190
@@ -414,7 +417,8 @@ def plot_sweep(
414417 for k , v in input_vars_in .items ():
415418 param_var = self .convert_vars_to_params (k , "input" , run_cfg )
416419 if isinstance (v , list ):
417- assert len (v ) > 0
420+ if len (v ) == 0 :
421+ raise ValueError (f"Input variable '{ k } ' cannot be an empty list" )
418422 param_var = param_var .with_sample_values (v )
419423
420424 else :
0 commit comments