HakaiInstitute / hakai-ctd-qc

Series of tests applied to the Hakai CTD profile data based on the QARTOD tests and other Hakai Specific ones.
0 stars 0 forks source link

suppress sentry messages in cmd line output #43

Open fostermh opened 3 months ago

fostermh commented 3 months ago

We continue to get the following output by the corn jobs running this application

[36mhakai-profile-qc_1  | [0m Sentry is attempting to send 3 pending events
 [36mhakai-profile-qc_1  | [0m Waiting up to 2 seconds
 [36mhakai-profile-qc_1  | [0m Press Ctrl-C to quit

I suspect flushing the sentry event queue before closing the application might help.

Perhaps praing the contents of the main function in a try except block would help? or adding a decorator function see here for a discussion

try:
    ...main code here...
except Exception as err:
    sentry_sdk.capture_exception(err)
    sentry_sdk.flush()
    raise err # rerasing the error is optional in this case.
finally:
    sentry_sdk.flush()