@@ -114,13 +114,13 @@ def _get_matching_s3_keys_generator(self, prefix="", suffix=""):
114114 def _upload_string_to_s3 (self , string , key ):
115115 self .s3 .put_object (Bucket = self .bucket , Key = key , Body = string )
116116
117- def _read_bytes_from_s3 (self , key , allow_missing = True ):
117+ def _read_bytes_from_s3 (self , key , allow_missing = False ):
118118 try :
119119 byte_array = self .s3 .get_object (Bucket = self .bucket , Key = key )["Body" ].read ()
120120 except self .s3 .exceptions .NoSuchKey as e :
121121 if allow_missing :
122122 return None
123- raise e
123+ raise CortexException ( "bucket " + self . bucket , "key " + key ) from e
124124
125125 return byte_array .strip ()
126126
@@ -130,7 +130,7 @@ def search(self, prefix="", suffix=""):
130130 def put_json (self , obj , key ):
131131 self ._upload_string_to_s3 (json .dumps (obj ), key )
132132
133- def get_json (self , key , allow_missing = True ):
133+ def get_json (self , key , allow_missing = False ):
134134 obj = self ._read_bytes_from_s3 (key , allow_missing ).decode ("utf-8" )
135135 if obj is None :
136136 return None
@@ -139,7 +139,7 @@ def get_json(self, key, allow_missing=True):
139139 def put_msgpack (self , obj , key ):
140140 self ._upload_string_to_s3 (msgpack .dumps (obj ), key )
141141
142- def get_msgpack (self , key , allow_missing = True ):
142+ def get_msgpack (self , key , allow_missing = False ):
143143 obj = self ._read_bytes_from_s3 (key , allow_missing )
144144 if obj == None :
145145 return None
@@ -148,7 +148,7 @@ def get_msgpack(self, key, allow_missing=True):
148148 def put_pyobj (self , obj , key ):
149149 self ._upload_string_to_s3 (pickle .dumps (obj ), key )
150150
151- def get_pyobj (self , key , allow_missing = True ):
151+ def get_pyobj (self , key , allow_missing = False ):
152152 obj = self ._read_bytes_from_s3 (key , allow_missing )
153153 if obj is None :
154154 return None
0 commit comments