Commit 596ae2d7 authored by Klaus Zimmermann's avatar Klaus Zimmermann
Browse files

Add command line option to deactivate sentry (closes #119)

parent 34eccac4
......@@ -27,15 +27,15 @@ import logging
logging.basicConfig(level=logging.INFO)
sentry_sdk.init("https://d3ac73a62877407b848dfc3f318bed85@sentry.io/1458386")
MISSVAL = 1.0e20
def parse_args():
parser = argparse.ArgumentParser(
description=(f'A climate index thing, version {climix.__version__}.'))
parser.add_argument('-e', '--deactivate-error-tracking',
action='store_true',
help='deactivate sentry based error tracking')
parser.add_argument('-d', '--dask-scheduler', choices=SCHEDULERS.keys(),
default='distributed-local-cluster')
parser.add_argument('-k', '--keep-open', action='store_true',
......@@ -54,6 +54,12 @@ def parse_args():
return parser.parse_args()
def init_sentry():
logging.info('Activating sentry')
sentry_sdk.init(
"https://d3ac73a62877407b848dfc3f318bed85@sentry.io/1458386")
def ignore_cb(cube, field, filename):
cube.attributes.pop('creation_date', None)
cube.attributes.pop('tracking_id', None)
......@@ -276,6 +282,8 @@ def do_main(requested_indices, datafiles, output_template, sliced_mode):
def main():
args = parse_args()
if not args.deactivate_error_tracking:
init_sentry()
with setup_scheduler(args) as scheduler:
logging.info('Scheduler ready; starting main program.')
start = time.time()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment