Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
climix
climix
Commits
596ae2d7
Commit
596ae2d7
authored
Nov 04, 2019
by
Klaus Zimmermann
Browse files
Add command line option to deactivate sentry (closes #119)
parent
34eccac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
climix/main.py
View file @
596ae2d7
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment