@@ -214,6 +214,7 @@ def main():
214
214
from nipype import logging as nlogging
215
215
from multiprocessing import set_start_method , Process , Manager
216
216
from ..utils .bids import write_derivative_description , validate_input_dir
217
+ from ..__about__ import __ga_id__
217
218
set_start_method ('forkserver' )
218
219
warnings .showwarning = _warn_redirect
219
220
opts = get_parser ().parse_args ()
@@ -229,11 +230,9 @@ def main():
229
230
if os .getenv ('DOCKER_VERSION_8395080871' ):
230
231
exec_env = 'dmriprep-docker'
231
232
232
- sentry_sdk = None
233
233
if not opts .notrack :
234
- import sentry_sdk
235
- from ..utils .sentry import sentry_setup
236
- sentry_setup (opts , exec_env )
234
+ import popylar
235
+ popylar .track_event (__ga_id__ , 'run' , 'cli_run' )
237
236
238
237
# Validate inputs
239
238
if not opts .skip_bids_validation :
@@ -301,27 +300,14 @@ def main():
301
300
# Clean up master process before running workflow, which may create forks
302
301
gc .collect ()
303
302
304
- # Sentry tracking
305
- if not opts .notrack :
306
- from ..utils .sentry import start_ping
307
- start_ping (run_uuid , len (subject_list ))
308
-
309
303
errno = 1 # Default is error exit unless otherwise set
310
304
try :
311
305
dmriprep_wf .run (** plugin_settings )
312
306
except Exception as e :
313
307
if not opts .notrack :
314
- from ..utils .sentry import process_crashfile
315
- crashfolders = [output_dir / 'dmriprep' / 'sub-{}' .format (s ) / 'log' / run_uuid
316
- for s in subject_list ]
317
- for crashfolder in crashfolders :
318
- for crashfile in crashfolder .glob ('crash*.*' ):
319
- process_crashfile (crashfile )
320
-
321
- if "Workflow did not execute cleanly" not in str (e ):
322
- sentry_sdk .capture_exception (e )
308
+ popylar .track_event (__ga_id__ , 'run' , 'cli_error' )
323
309
logger .critical ('dMRIPrep failed: %s' , e )
324
- raise
310
+ raise e
325
311
else :
326
312
if opts .run_reconall :
327
313
from templateflow import api
@@ -334,8 +320,8 @@ def main():
334
320
errno = 0
335
321
logger .log (25 , 'dMRIPrep finished without errors' )
336
322
if not opts .notrack :
337
- sentry_sdk . capture_message ( 'dMRIPrep finished without errors' ,
338
- level = 'info' )
323
+ popylar . track_event ( __ga_id__ , 'run' , 'cli_finished' )
324
+
339
325
finally :
340
326
from niworkflows .reports import generate_reports
341
327
from subprocess import check_call , CalledProcessError , TimeoutExpired
@@ -389,10 +375,6 @@ def main():
389
375
packagename = 'dmriprep' )
390
376
write_derivative_description (bids_dir , output_dir / 'dmriprep' )
391
377
392
- if failed_reports and not opts .notrack :
393
- sentry_sdk .capture_message (
394
- 'Report generation failed for %d subjects' % failed_reports ,
395
- level = 'error' )
396
378
sys .exit (int ((errno + failed_reports ) > 0 ))
397
379
398
380
0 commit comments