Skip to content

Unhelpful error message with waveform extraction writing and insufficient space #1063

Closed

Description

@DradeAW

Hi,

I have the following code:

si.extract_waveforms(recording, sorting, folder_path, allow_unfiltered=True, ms_before=5.0, ms_after=5.0, max_spikes_per_unit=2000, chunk_duration='1s', n_jobs=16)

Which gave the following error message:

Traceback (most recent call last):
  File "/users/nsr/wyngaard/dev/miniconda3/envs/lussac2/bin/lussac", line 33, in <module>
    sys.exit(load_entry_point('lussac', 'console_scripts', 'lussac')())
  File "/export/home1/users/nsr/wyngaard/Documents/lussac2/lussac/main.py", line 58, in main
    pipeline.launch()
  File "/export/home1/users/nsr/wyngaard/Documents/lussac2/lussac/core/pipeline.py", line 41, in launch
    self._run_mono_sorting_module(module, module_key, category, params)
  File "/export/home1/users/nsr/wyngaard/Documents/lussac2/lussac/core/pipeline.py", line 79, in _run_mono_sorting_module
    sub_sorting = module_instance.run(params)
  File "/export/home1/users/nsr/wyngaard/Documents/lussac2/lussac/modules/align_units.py", line 34, in run
    templates, wvf_extractor, margin = self.get_templates(params['wvf_extraction'], params['filter'], return_extractor=True)
  File "/export/home1/users/nsr/wyngaard/Documents/lussac2/lussac/core/module.py", line 194, in get_templates
    wvf_extractor = self.extract_waveforms(sub_folder=sub_folder, **params)
  File "/export/home1/users/nsr/wyngaard/Documents/lussac2/lussac/core/module.py", line 163, in extract_waveforms
    return si.extract_waveforms(self.data.recording, sorting, folder_path, allow_unfiltered=True, **params)
  File "/export/home1/users/nsr/wyngaard/dev/spikeinterface/spikeinterface/spikeinterface/core/waveform_extractor.py", line 987, in extract_waveforms
    we.run_extract_waveforms(seed=seed, **job_kwargs)
  File "/export/home1/users/nsr/wyngaard/dev/spikeinterface/spikeinterface/spikeinterface/core/waveform_extractor.py", line 858, in run_extract_waveforms
    wfs_arrays = extract_waveforms_to_buffers(self.recording, spikes, unit_ids, nbefore, nafter,
  File "/export/home1/users/nsr/wyngaard/dev/spikeinterface/spikeinterface/spikeinterface/core/waveform_tools.py", line 83, in extract_waveforms_to_buffers
    distribute_waveforms_to_buffers(recording, spikes, unit_ids, wfs_arrays_info, nbefore, nafter, return_scaled,
  File "/export/home1/users/nsr/wyngaard/dev/spikeinterface/spikeinterface/spikeinterface/core/waveform_tools.py", line 234, in distribute_waveforms_to_buffers
    processor.run()
  File "/export/home1/users/nsr/wyngaard/dev/spikeinterface/spikeinterface/spikeinterface/core/job_tools.py", line 312, in run
    for res in results:
  File "/users/nsr/wyngaard/dev/miniconda3/envs/lussac2/lib/python3.10/concurrent/futures/process.py", line 567, in _chain_from_iterable_of_lists
    for element in iterable:
  File "/users/nsr/wyngaard/dev/miniconda3/envs/lussac2/lib/python3.10/concurrent/futures/_base.py", line 609, in result_iterator
    yield fs.pop().result()
  File "/users/nsr/wyngaard/dev/miniconda3/envs/lussac2/lib/python3.10/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/users/nsr/wyngaard/dev/miniconda3/envs/lussac2/lib/python3.10/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

It was a pain to debug, but it turns out that the problem was due to my disk not having enough space left to extract the waveforms.

I think there should be a check to see if there is enough space left on the disk or a try catch, so that a more helpful error message can be thrown during multi-threading.

Activity

  1. alejoe91 commented on Nov 21, 2022

    @alejoe91
    Member

    Thansk @DradeAW

    Can you make a PR? Maybe we could estimate a rough folder size and then check that we have at least twice the space?

  2. added
    bug
    on Nov 28, 2022
  3. changed the title [-]Unhelpful error message waveform extraction[/-] [+]Unhelpful error message with waveform extraction writing and insufficient space[/+] on Mar 27, 2023
  4. mhhennig commented on May 14, 2023

    @mhhennig
    Member

    This is also an issue when mode="memory". Then python just throws a Bus Error and dies. Not sure how this can be mitigated...?

  5. zm711 commented on Nov 7, 2023

    @zm711
    Member

    Just to keep this fresh on people's minds I just ran into this issue again.

  6. Antho2422 commented on Nov 21, 2023

    @Antho2422
    Contributor

    Hi all, just to add one more, I also ran into this issue when running SC2. Do you think this can come from the fact that I don't have enough memory as mentionned in #1063 (comment).

    Traceback (most recent call last):
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/sorters/basesorter.py", line 254, in run_from_folder
        SorterClass._run_from_folder(sorter_output_folder, sorter_params, verbose)
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/sorters/internal/spyking_circus2.py", line 112, in _run_from_folder
        labels, peak_labels = find_cluster_from_peaks(
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/sortingcomponents/clustering/main.py", line 42, in find_cluster_from_peaks
        labels, peak_labels = method_class.main_function(recording, peaks, params)
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/sortingcomponents/clustering/random_projections.py", line 218, in main_function
        we = extract_waveforms(
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/core/waveform_extractor.py", line 1643, in extract_waveforms
        we.run_extract_waveforms(seed=seed, **job_kwargs)
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/core/waveform_extractor.py", line 1402, in run_extract_waveforms
        wfs_arrays = extract_waveforms_to_buffers(
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/core/waveform_tools.py", line 96, in extract_waveforms_to_buffers
        distribute_waveforms_to_buffers(
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/core/waveform_tools.py", line 279, in distribute_waveforms_to_buffers
        processor.run()
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/spikeinterface/core/job_tools.py", line 399, in run
        for res in results:
      File "/network/lustre/iss01/apps/teams/charpier/poetry_envs/priam-ot_OBODV-py3.9/lib/python3.9/site-packages/tqdm/std.py", line 1182, in __iter__
        for obj in iterable:
      File "/network/lustre/iss01/apps/lang/anaconda/3/2021.11-2/lib/python3.9/concurrent/futures/process.py", line 559, in _chain_from_iterable_of_lists
        for element in iterable:
      File "/network/lustre/iss01/apps/lang/anaconda/3/2021.11-2/lib/python3.9/concurrent/futures/_base.py", line 608, in result_iterator
        yield fs.pop().result()
      File "/network/lustre/iss01/apps/lang/anaconda/3/2021.11-2/lib/python3.9/concurrent/futures/_base.py", line 438, in result
        return self.__get_result()
      File "/network/lustre/iss01/apps/lang/anaconda/3/2021.11-2/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
        raise self._exception
    concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

    This is weird because I guess that I should have enough space to save the waveforms on disk.

  7. zm711 commented on Jun 19, 2024

    @zm711
    Member

    I'll close this since I have a more up-to-date issue that we can use to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions