3131
3232
3333CONFIG_DEPRECATIONS = {
34- 'profile_runtime' : ('resource_monitor ' , '1.0' ),
35- 'filemanip_level' : ('utils_level' , '1.0' ),
34+ 'profile_runtime' : ('monitoring.enabled ' , '1.0' ),
35+ 'filemanip_level' : ('logging. utils_level' , '1.0' ),
3636}
3737
3838NUMPY_MMAP = LooseVersion (np .__version__ ) >= LooseVersion ('1.12.0' )
7171parameterize_dirs = true
7272poll_sleep_duration = 2
7373xvfb_max_wait = 10
74- resource_monitor = false
75- resource_monitor_frequency = 1
74+
75+ [monitoring]
76+ enabled = false
77+ sample_frequency = 1
78+ summary_append = true
7679
7780[check]
7881interval = 1209600
@@ -105,12 +108,12 @@ def __init__(self, *args, **kwargs):
105108 self ._config .read ([config_file , 'nipype.cfg' ])
106109
107110 for option in CONFIG_DEPRECATIONS :
108- for section in ['execution' , 'logging' ]:
111+ for section in ['execution' , 'logging' , 'monitoring' ]:
109112 if self .has_option (section , option ):
110- new_option = CONFIG_DEPRECATIONS [option ][0 ]
111- if not self .has_option (section , new_option ):
113+ new_section , new_option = CONFIG_DEPRECATIONS [option ][0 ]. split ( '.' )
114+ if not self .has_option (new_section , new_option ):
112115 # Warn implicit in get
113- self .set (section , new_option , self .get (section , option ))
116+ self .set (new_section , new_option , self .get (section , option ))
114117
115118 def set_default_config (self ):
116119 self ._config .readfp (StringIO (default_cfg ))
@@ -138,7 +141,7 @@ def get(self, section, option, default=None):
138141 '"%s" instead.' ) % (option , CONFIG_DEPRECATIONS [option ][1 ],
139142 CONFIG_DEPRECATIONS [option ][0 ])
140143 warn (msg )
141- option = CONFIG_DEPRECATIONS [option ][0 ]
144+ section , option = CONFIG_DEPRECATIONS [option ][0 ]. split ( '.' )
142145
143146 if self ._config .has_option (section , option ):
144147 return self ._config .get (section , option )
@@ -154,7 +157,7 @@ def set(self, section, option, value):
154157 '"%s" instead.' ) % (option , CONFIG_DEPRECATIONS [option ][1 ],
155158 CONFIG_DEPRECATIONS [option ][0 ])
156159 warn (msg )
157- option = CONFIG_DEPRECATIONS [option ][0 ]
160+ section , option = CONFIG_DEPRECATIONS [option ][0 ]. split ( '.' )
158161
159162 return self ._config .set (section , option , value )
160163
@@ -222,8 +225,8 @@ def resource_monitor(self):
222225 return self ._resource_monitor
223226
224227 # Cache config from nipype config
225- self .resource_monitor = self ._config .get (
226- 'execution ' , 'resource_monitor' ) or False
228+ self .resource_monitor = str2bool ( self ._config .get (
229+ 'monitoring ' , 'enabled' ) ) or False
227230 return self ._resource_monitor
228231
229232 @resource_monitor .setter
@@ -248,7 +251,7 @@ def resource_monitor(self, value):
248251 if not self ._resource_monitor :
249252 warn ('Could not enable the resource monitor: psutil>=5.0'
250253 ' could not be imported.' )
251- self ._config .set ('execution ' , 'resource_monitor ' ,
254+ self ._config .set ('monitoring ' , 'enabled ' ,
252255 ('%s' % self ._resource_monitor ).lower ())
253256
254257 def enable_resource_monitor (self ):
0 commit comments