function handle_n_jobs

deeptime.util.parallel.handle_n_jobs(value: Optional[int]) int

Handles the n_jobs parameter consistently so that a non-negative number is returned. In particular, if

  • value is None, use 1 job

  • value is negative, use number cores available * 2

  • value is positive, use value

Parameters:

value (int or None) – The provided n_jobs argument

Returns:

n_jobs – A non-negative integer value describing how many threads can be started simultaneously.

Return type:

int