@@ -93,6 +93,9 @@ def main():
93
93
sentry_sdk .capture_message ('fMRIPrep started' , level = 'info' )
94
94
95
95
config .loggers .workflow .log (25 , 'fMRIPrep started!' )
96
+ config .loggers .workflow .log (15 , '\n ' .join (
97
+ ['fMRIPrep config:' ] + ['\t \t %s' % s for s in config .dumps ().splitlines ()])
98
+ )
96
99
errno = 1 # Default is error exit unless otherwise set
97
100
try :
98
101
fmriprep_wf .run (** config .nipype .get_plugin ())
@@ -113,13 +116,20 @@ def main():
113
116
config .loggers .workflow .critical ('fMRIPrep failed: %s' , e )
114
117
raise
115
118
else :
116
-
117
119
config .loggers .workflow .log (25 , 'fMRIPrep finished successfully!' )
118
120
if not config .execution .notrack :
119
121
success_message = 'fMRIPrep finished without errors'
120
122
sentry_sdk .add_breadcrumb (message = success_message , level = 'info' )
121
123
sentry_sdk .capture_message (success_message , level = 'info' )
122
124
125
+ # Bother users with the boilerplate only iff the workflow went okay.
126
+ if (config .execution .output_dir / 'fmriprep' / 'logs' / 'CITATION.md' ).exists ():
127
+ config .loggers .workflow .log (
128
+ 25 , 'Works derived from this fMRIPrep execution should '
129
+ 'include the following boilerplate:\n \n %s' ,
130
+ (config .execution .output_dir / 'fmriprep' / 'logs' / 'CITATION.md' ).read_text ()
131
+ )
132
+
123
133
if config .workflow .run_reconall :
124
134
from templateflow import api
125
135
from niworkflows .utils .misc import _copy_any
@@ -131,52 +141,7 @@ def main():
131
141
errno = 0
132
142
finally :
133
143
from niworkflows .reports import generate_reports
134
- from subprocess import check_call , CalledProcessError , TimeoutExpired
135
144
from pkg_resources import resource_filename as pkgrf
136
- from shutil import copyfile
137
-
138
- citation_files = {
139
- ext : config .execution .output_dir / 'fmriprep' / 'logs'
140
- / ('CITATION.%s' % ext ) for ext in ('bib' , 'tex' , 'md' , 'html' )
141
- }
142
-
143
- if not config .execution .md_only_boilerplate and citation_files ['md' ].exists ():
144
- # Generate HTML file resolving citations
145
- cmd = ['pandoc' , '-s' , '--bibliography' ,
146
- pkgrf ('fmriprep' , 'data/boilerplate.bib' ),
147
- '--filter' , 'pandoc-citeproc' ,
148
- '--metadata' , 'pagetitle="fMRIPrep citation boilerplate"' ,
149
- str (citation_files ['md' ]),
150
- '-o' , str (citation_files ['html' ])]
151
-
152
- config .loggers .cli .info (
153
- 'Generating an HTML version of the citation boilerplate...' )
154
- try :
155
- check_call (cmd , timeout = 10 )
156
- except (FileNotFoundError , CalledProcessError , TimeoutExpired ):
157
- config .loggers .cli .warning (
158
- 'Could not generate CITATION.html file:\n %s' , ' ' .join (cmd ))
159
-
160
- # Generate LaTex file resolving citations
161
- cmd = ['pandoc' , '-s' , '--bibliography' ,
162
- pkgrf ('fmriprep' , 'data/boilerplate.bib' ),
163
- '--natbib' , str (citation_files ['md' ]),
164
- '-o' , str (citation_files ['tex' ])]
165
- config .loggers .cli .info (
166
- 'Generating a LaTeX version of the citation boilerplate...' )
167
- try :
168
- check_call (cmd , timeout = 10 )
169
- except (FileNotFoundError , CalledProcessError , TimeoutExpired ):
170
- config .loggers .cli .warning (
171
- 'Could not generate CITATION.tex file:\n %s' , ' ' .join (cmd ))
172
- else :
173
- copyfile (pkgrf ('fmriprep' , 'data/boilerplate.bib' ),
174
- citation_files ['bib' ])
175
- else :
176
- config .loggers .cli .warning (
177
- 'fMRIPrep could not find the markdown version of '
178
- 'the citation boilerplate (%s). HTML and LaTeX versions'
179
- ' of it will not be available' , citation_files ['md' ])
180
145
181
146
# Generate reports phase
182
147
failed_reports = generate_reports (
0 commit comments