@@ -16,6 +16,7 @@ thread and memory usage: ``num_threads`` and ``estimated_memory_gb``. If a
16
16
particular node is expected to use 8 threads and 2 GB of memory:
17
17
18
18
::
19
+
19
20
import nipype.pipeline.engine as pe
20
21
node = pe.Node()
21
22
node.interface.num_threads = 8
@@ -34,6 +35,7 @@ the workflow. The plugin utilizes the plugin arguments ``n_procs`` and
34
35
workflow to using 4 cores and 6 GB of RAM:
35
36
36
37
::
38
+
37
39
args_dict = {'n_procs' : 4, 'memory_gb' : 6}
38
40
workflow.run(plugin='MultiProc', plugin_args=args_dict)
39
41
@@ -79,14 +81,15 @@ by setting the ``status_callback`` parameter to point to this function in the
79
81
``plugin_args `` when using the ``MultiProc `` plugin.
80
82
81
83
::
84
+
82
85
from nipype.pipeline.plugins.callback_log import log_nodes_cb
83
- args_dict = {'n_procs' : 4, 'memory_gb' : 6,
84
- 'status_callback' : log_nodes_cb}
86
+ args_dict = {'n_procs' : 4, 'memory_gb' : 6, 'status_callback' : log_nodes_cb}
85
87
86
88
To set the filepath for the callback log the ``'callback' `` logger must be
87
89
configured.
88
90
89
91
::
92
+
90
93
# Set path to log file
91
94
import logging
92
95
callback_log_path = '/home/user/run_stats.log'
@@ -98,13 +101,15 @@ configured.
98
101
Finally, the workflow can be run.
99
102
100
103
::
104
+
101
105
workflow.run(plugin='MultiProc', plugin_args=args_dict)
102
106
103
107
After the workflow finishes executing, the log file at
104
108
"/home/user/run_stats.log" can be parsed for the runtime statistics. Here is an
105
109
example of what the contents would look like:
106
110
107
111
::
112
+
108
113
{"name":"resample_node","id":"resample_node",
109
114
"start":"2016-03-11 21:43:41.682258",
110
115
"estimated_memory_gb":2,"num_threads":1}
@@ -135,16 +140,16 @@ The pandas_ Python package is required to use this feature.
135
140
.. _pandas : http://pandas.pydata.org/
136
141
137
142
::
143
+
138
144
from nipype.pipeline.plugins.callback_log import log_nodes_cb
139
- args_dict = {'n_procs' : 4, 'memory_gb' : 6,
140
- 'status_callback' : log_nodes_cb}
145
+ args_dict = {'n_procs' : 4, 'memory_gb' : 6, 'status_callback' : log_nodes_cb}
141
146
workflow.run(plugin='MultiProc', plugin_args=args_dict)
142
147
143
148
# ...workflow finishes and writes callback log to '/home/user/run_stats.log'
144
149
145
150
from nipype.utils.draw_gantt_chart import generate_gantt_chart
146
151
generate_gantt_chart('/home/user/run_stats.log', cores=4)
147
- # ...creates gantt chart in '/home/user/run_stats.log.html'
152
+ # ...creates gantt chart in '/home/user/run_stats.log.html'
148
153
149
154
The `generate_gantt_chart`` function will create an html file that can be viewed
150
155
in a browser. Below is an example of the gantt chart displayed in a web browser.
0 commit comments