Browse Source

try except in the test for saving results in mongo

tanja 3 years ago
parent
commit
20f8808d0c
1 changed files with 13 additions and 4 deletions
  1. 13 4
      cdplib/hyperopt/HyperoptPipelineSelector.py

+ 13 - 4
cdplib/hyperopt/HyperoptPipelineSelector.py

@@ -470,11 +470,20 @@ if __name__ == '__main__':
     hs.attach_data_from_hdf5(data_hdf5_store_path=data_path,
                              cv_pickle_path=cv_path)
 
-    save_method = MongodbHandler().insert_data_into_collection
-    save_kwargs = {'collection_name': collection_name}
+    try:
 
-    hs.configer_summary_saving(save_method=save_method,
-                               kwargs=save_kwargs)
+        save_method = MongodbHandler().insert_data_into_collection
+        save_kwargs = {'collection_name': collection_name}
+
+        hs.configer_summary_saving(save_method=save_method,
+                                   kwargs=save_kwargs)
+
+        logger.info("Configured summary saving in mongo")
+
+    except Exception as e:
+
+        logger.warn(("Could not configure summary saving in mongo. "
+                     "Exit with error: {}".format(e)))
 
     hs.run_trials(niter=10)