@@ -18,7 +18,10 @@ class ParsedBundle(namedtuple('ParsedBundle', ['bundle_uuid', 'metadata_dict', '
18
18
def pprint (self ):
19
19
return pprint .pformat (self , indent = 4 )
20
20
21
+
21
22
class StandardFormatBundleUploader :
23
+ _uuid_regex = re .compile ('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' )
24
+
22
25
def __init__ (self , dss_uploader : DssUploader , metadata_file_uploader : MetadataFileUploader ) -> None :
23
26
self .dss_uploader = dss_uploader
24
27
self .metadata_file_uploader = metadata_file_uploader
@@ -35,10 +38,9 @@ def _parse_bundle(bundle: dict) -> ParsedBundle:
35
38
raise
36
39
return ParsedBundle (bundle_uuid , metadata_dict , data_objects )
37
40
38
- @staticmethod
39
- def _get_file_uuid (file_guid : str ):
40
- uuid_regex = re .compile ('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' )
41
- result = uuid_regex .findall (file_guid .lower ())
41
+ @classmethod
42
+ def _get_file_uuid (cls , file_guid : str ):
43
+ result = cls ._uuid_regex .findall (file_guid .lower ())
42
44
if result is None :
43
45
raise ValueError (f'Misformatted file_guid: { file_guid } should contain a uuid.' )
44
46
if len (result ) != 1 :
@@ -118,6 +120,7 @@ def load_all_bundles(self, input_json: typing.List[dict]):
118
120
bundles_loaded .append (bundle )
119
121
logger .info (f'Successfully loaded bundle { parsed_bundle .bundle_uuid } ' )
120
122
except KeyboardInterrupt :
123
+ # The bundle that was being processed durng the iterrupt isn't recorded anywhere
121
124
logger .exception ('Loading canceled with keyboard interrupt' )
122
125
finally :
123
126
bundles_unattempted = len (input_json ) \
0 commit comments