cms-gem-daq-project / gem-plotting-tools

Repository for GEM commissioning plotting tools
GNU General Public License v3.0
1 stars 26 forks source link

rethrow exceptions from cx_Oracle #251

Closed AndrewLevin closed 4 years ago

AndrewLevin commented 4 years ago

cx_Oracle throws exceptions objects that cannot be pickled, which is a problem for our multithreading framework, so this pull requests rethrows exceptions that cannot be pickled.

Description

In the function getVFAT3CalInfo, a try-catch block is added around the call to getVFAT3ProdSumView. When an exception is caught, it tries to pickle the exception, and checks whether a TypeError exception is throw by the pickler. If there is no TypeError, the original exception is rethrown. If there is a TypeError, then a new exception is created which records the type and the message of the original exception.

Types of changes

Motivation and Context

Partially resolves https://github.com/cms-gem-daq-project/gem-plotting-tools/issues/250. The underlying cause of the exception reported in that issue is not understood.

How Has This Been Tested?

Yes:

Launching scurve analysis processes, this may take some time, please be patient
Caught <type 'exceptions.Exception'>: This is a rethrown exception. The original exception type was: <class 'cx_Oracle.DatabaseError'>. The original exception message was: ORA-01017: invalid username/password; logon denied
, terminating workers

Screenshots (if appropriate):

Checklist:

AndrewLevin commented 4 years ago

Are there any other places that we need to add protection for DB exceptions? Might be safer to find the places where the connect method is actually called, and just protect those

I think the connect method is only called in one place in dbutils, but I think similar exceptions could be throw in other interactions with the db, such as querying the db after we connect.