Decorator for handling parallelization via parallel keyword/client detection


func (callable) – Typically a Syncopy metafunction such as freqanalysis()


parallel_client_detector – Wrapped function; parallel_client_detector attempts to extract parallel from keywords provided to func. If parallel is True or None (i.e., was not provided) and dask is available, parallel_client_detector attempts to connect to a running dask parallel processing client. If successful, parallel is set to True and updated in func’s keyword argument dict. If no client is found or dask is not available, a corresponding warning message is printed and parallel is set to False and updated in func’s keyword argument dict. After successfully calling func with the modified input arguments, parallel_client_detector modifies func itself:

  1. The “Parameters” section in the docstring of func is amended by an entry explaining the usage of parallel. Note: func’s docstring is only extended if it has a “Parameters” section.

  2. If not already present, parallel is added as optional keyword (with default value None) to the signature of func.

Return type



This decorator assumes that func has already been processed by unwrap_cfg() and hence expects func to obey standard Python call signature func(*args, **kwargs). In other words, detect_parallel_client() is intended as “inner” decorator of, e.g., metafunctions. See Notes in the docstring of unwrap_select() for further details.

See also


extract select keyword and process in-place data-selections


Decorator for processing cfg “structs”