@@ -50,8 +50,22 @@ def validate_job(self, job_obj):
5050 # return
5151
5252 def __exec_actual_job (self , each_child , lock ) -> bool :
53- current_granule_stac : Item = self .__gc .get_granules_item (each_child )
54- current_collection_id = current_granule_stac .collection_id .strip ()
53+ try :
54+ current_granule_stac : Item = self .__gc .get_granules_item (each_child )
55+ current_collection_id = current_granule_stac .collection_id .strip ()
56+ except Exception as e :
57+ LOGGER .exception (f'error while processing: { each_child } ' )
58+ error_item = Item (id = 'unknown' ,
59+ properties = {'message' : 'unknown error' , 'granule' : each_child , 'details' : str (e )},
60+ geometry = {
61+ "type" : "Point" ,
62+ "coordinates" : [0.0 , 0.0 ]
63+ },
64+ bbox = [0.0 , 0.0 , 0.0 , 0.0 ],
65+ datetime = TimeUtils ().parse_from_unix (0 , True ).get_datetime_obj (),
66+ collection = 'unknown' )
67+ self .__error_list .put (error_item .to_dict (False , False ))
68+ return True
5569 try :
5670 current_collection_id = GranulesCatalog .get_unity_formatted_collection_id (current_collection_id , self .__project_venue_set )
5771 LOGGER .debug (f'reformatted current_collection_id: { current_collection_id } ' )
@@ -211,14 +225,19 @@ def __actual_upload(self):
211225 FileUtils .write_json (failed_features_file , failed_item_collections .to_dict (False ))
212226 if len (failed_item_collections .items ) > 0 :
213227 LOGGER .fatal (f'One or more Failures: { failed_item_collections .to_dict (False )} ' )
228+
229+ LOGGER .debug (f'creating response catalog' )
230+ catalog_json = GranulesCatalog ().update_catalog (catalog_file_path , [successful_features_file , failed_features_file ])
231+ LOGGER .debug (f'catalog_json: { catalog_json } ' )
232+ if len (successful_item_collections ) < 1 : # TODO check this.
233+ LOGGER .debug (f'No successful items in Upload: Not uploading successful_features_ to s3://{ self ._staging_bucket } /{ self ._result_path_prefix } ' )
234+ return json .dumps (catalog_json )
235+
214236 s3_url = self .__s3 .upload (successful_features_file , self ._staging_bucket ,
215237 self ._result_path_prefix ,
216238 s3_name = f'successful_features_{ TimeUtils .get_current_time ()} .json' ,
217239 delete_files = self ._delete_files )
218240 LOGGER .debug (f'uploaded successful features to S3: { s3_url } ' )
219- LOGGER .debug (f'creating response catalog' )
220- catalog_json = GranulesCatalog ().update_catalog (catalog_file_path , [successful_features_file , failed_features_file ])
221- LOGGER .debug (f'catalog_json: { catalog_json } ' )
222241 return json .dumps (catalog_json )
223242
224243 def __exec_dry_run (self ):
0 commit comments