@@ -331,19 +331,37 @@ def get_library(self, library_suffix: Union[str, int] = None) -> Library:
331
331
Returns a library on persistent space. (created if do not exist)
332
332
The name is constructed internally, but user can add a suffix (index)
333
333
Uses `get_library_name` to construct the name
334
+
335
+ IMPORTANT: `get_library` will always return Library even if none exist will be created new!
334
336
"""
335
337
return self ._get_lib (self .get_arctic_client_persistent (),
336
338
self .get_library_name (LibraryType .PERSISTENT , library_suffix ))
337
-
339
+
340
+ def has_library (self , library_suffix : Union [str , int ] = None ) -> bool :
341
+ """
342
+ checks if there is a library with that suffix on persistent storage space
343
+ """
344
+ return self .get_arctic_client_persistent ().has_library (self .get_library_name (LibraryType .PERSISTENT ,
345
+ library_suffix ))
346
+
338
347
def get_modifiable_library (self , library_suffix : Union [str , int ] = None ) -> Library :
339
348
"""
340
349
Returns library to read write and delete after done. (create if not exist is on!)
341
350
The name is constructed internally, but user can add a suffix (index)
342
351
Uses `get_library_name` to construct the name
352
+
353
+ IMPORTANT: `get_modifiable_library` will always return Library even if none exist will be created new!
343
354
"""
344
355
return self ._get_lib (self .get_arctic_client_modifiable (),
345
356
self .get_library_name (LibraryType .MODIFIABLE , library_suffix ))
346
357
358
+ def has_modifiable_library (self , library_suffix : Union [str , int ] = None ) -> bool :
359
+ """
360
+ checks if there is a library with that suffix on persistent storage space
361
+ """
362
+ return self .get_arctic_client_persistent ().has_library (self .get_library_name (LibraryType .MODIFIABLE ,
363
+ library_suffix ))
364
+
347
365
def delete_modifiable_library (self , library_suffix : Union [str , int ] = None ):
348
366
"""
349
367
Use this method to delete previously created library on modifiable storage
@@ -532,6 +550,8 @@ def check_ok(self):
532
550
if OK, setting things up can be skipped
533
551
"""
534
552
(list_rows , list_cols ) = self ._get_symbol_bounds ()
553
+ if not self .has_library ():
554
+ return False
535
555
lib = self .get_library ()
536
556
symbols = set (lib .list_symbols ())
537
557
self .logger ().info (f"Symbols { symbols } " )
@@ -664,6 +684,8 @@ def setup_all(self):
664
684
def check_ok (self ) -> bool :
665
685
666
686
for num_symbols in self .get_parameter_list ():
687
+ if not self .has_library (num_symbols ):
688
+ return False
667
689
lib = self .get_library (num_symbols )
668
690
symbols = set (lib .list_symbols ())
669
691
self .logger ().info (f"Check library: { lib } " )
@@ -995,6 +1017,8 @@ def check_ok(self):
995
1017
(list_rows , list_cols ) = self ._get_symbol_bounds ()
996
1018
997
1019
for num_symbols in self ._params [self .param_index_num_symbols ]:
1020
+ if not self .has_library (num_symbols ):
1021
+ return False
998
1022
lib = self .get_library (num_symbols )
999
1023
self .logger ().debug (f"Library { lib } " )
1000
1024
for num_symbol in range (num_symbols ):
@@ -1089,6 +1113,7 @@ def test_setup_versions_and_snapshots(cls):
1089
1113
#Delete-setup-all-check
1090
1114
cls .delete_test_store (setup )
1091
1115
setup .setup_environment ()
1116
+ setup .logger ().info (setup .get_arctic_client_persistent ().list_libraries ())
1092
1117
assert setup .check_ok ()
1093
1118
1094
1119
#Changing parameters should trigger not ok for setup
0 commit comments