remove output from joblib

  • MNE version: 1.4
  • operating system: macOS 13.4

I am running some code with raw.compute_psd with option n_jobs=16.
I am getting the output:

[Parallel(n_jobs=16)]: Using backend LokyBackend with 16 concurrent workers.
[Parallel(n_jobs=16)]: Done   5 out of  16 | elapsed:    1.9s remaining:    4.2s
[Parallel(n_jobs=16)]: Done   9 out of  16 | elapsed:    2.0s remaining:    1.5s
[Parallel(n_jobs=16)]: Done  13 out of  16 | elapsed:    2.0s remaining:    0.5s
[Parallel(n_jobs=16)]: Done  16 out of  16 | elapsed:    2.1s finished

How do I suppress this output? I tried verbose=0 inside the compute_psd function. I also tried to put the computation inside a with joblib.parallel_config(verbose=0):, but no success.

Thank you for your help!

import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = (sample_data_folder / 'MEG' / 'sample' / 'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False, preload=False)
spect = raw.compute_psd(n_jobs=12, verbose=False)

When I run this on current main I see no joblib output.

The problem is passing verbose=0 instead of verbose=False. “truthy” and “falsy” values won’t do what you expect here, because underlyingly verbose is a system of integers/strings, and we use True and False as aliases for specific integer levels. See the table here: Configuring MNE-Python — MNE 1.4.2 documentation

2 Likes

Thank you! However it is also removing the information like:

Effective window size : 8.000 (s)

But that’s something I would like to keep. Is there some way to only remove the joblib output without removing the mne output?

Not presently (at least not that i can see). @larsoner WDYT about this? one reasonable approach might be a config value (MNE_JOBLIB_LOGGING_LEVEL or so) that can be set separately from the global logging level.

Yes, 2 different verboses options/configs would be great I imagine…

Sounds good to me. We could add it to set_log_level and use_log_level, and have the default joblib_verbose=None mean “use the verbose level” (which would preserve backward compat)

@chapochn would you be up for making a PR to implement this? If not, please open a GitHub issue linking back to this thread, so that we don’t lose track of the request.

I’ll just open an issue for now!

Here:

1 Like