osl_dynamics.meeg.parallel#

Run a processing function over multiple items in parallel.

Functions#

run(func, items, n_workers, log_dir[, output_dir, ...])

Run a function over items in parallel.

Module Contents#

osl_dynamics.meeg.parallel.run(func, items, n_workers, log_dir, output_dir=None, plots_dir=None)[source]#

Run a function over items in parallel.

Parameters:
  • func (callable) – Function to call for each item. Signature: func(item, logger).

  • items (list) – Items to process. Each item is passed as the first argument to func. Items can be strings or dicts. If a dict contains an "id" key, it is used as the session ID for logging; otherwise, a numeric index is used.

  • n_workers (int) – Number of parallel workers.

  • log_dir (str or Path) – Directory for per-item log files.

  • output_dir (str or Path, optional) – Derivatives directory. Passed to report generation for copying surface extraction plots.

  • plots_dir (str or Path, optional) – If provided, generate a QC report after processing.

Return type:

None