Filtering terminal_output in Workflow/Node in Nipype

I wanted to look into modifying the terminal output/stdout to include a filter_stream option; I saw the current options were [file,file_split, file_stdout, allatonce]

I wanted to look into adding a filter_stream flag that would accept a list of strings that I just want to ignore; I am playing around with permutations/randomise and for example I would want to ignore the string “Starting permutation”. I wasn’t sure which file I should inject this…

I started looking at utils/logger.py as well as interfaces/base/core.py

Can anyone offer any advice where to start?

file
Redirects both standard output and standard error to the same file called output.nipype. Messages from both streams will be overlapped as they arrive to the file.
file_split
Redirects the output streams separately, to stdout.nipype and stderr.nipype respectively, as described in the example.
file_stdout
Only the standard output will be redirected to stdout.nipype and the standard error will be discarded.
file_stderr
Only the standard error will be redirected to stderr.nipype and the standard output will be discarded.
stream
Both output streams are redirected to the current logger printing their messages interleaved and immediately to the terminal.
allatonce
Both output streams will be forwarded to a buffer and stored separately in the runtime object that the run() method returns. No files are written nor streams printed out to terminal.
none
Both outputs are discarded


180328-14:12:51,0 interface INFO:
stdout 2018-03-28T14:12:51.000370:Starting permutation 378
180328-14:12:51,18 interface INFO:
stdout 2018-03-28T14:12:51.018084:Starting permutation 379
180328-14:12:51,36 interface INFO:
stdout 2018-03-28T14:12:51.036746:Starting permutation 380
180328-14:12:51,55 interface INFO:

I think interfaces/base/core.py is the place to start. You’ll probably want to add an option to CommandLineInterface or possibly CommandLineInputSpec, and that will need to be routed through to run_command().

Thanks… I’ll dig around and if it becomes useful make a PR.