Class: Parallel

Tweak of joblib.Parallel that propagates the scikit-learn configuration.

This subclass of joblib.Parallel ensures that the active configuration (thread-local) of scikit-learn is propagated to the parallel workers for the duration of the execution of the parallel tasks.

The API does not change and you can refer to joblib.Parallel documentation for more details.

Python Reference

Constructors

new Parallel()

new Parallel(opts?): Parallel

Parameters

ParameterTypeDescription
opts?object-
opts.iterable?anyIterable containing tuples of (delayed_function, args, kwargs) that should be consumed.

Returns Parallel

Defined in generated/utils/parallel/Parallel.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/utils/parallel/Parallel.ts:23
_isInitializedbooleanfalsegenerated/utils/parallel/Parallel.ts:22
_pyPythonBridgeundefinedgenerated/utils/parallel/Parallel.ts:21
idstringundefinedgenerated/utils/parallel/Parallel.ts:18
optsanyundefinedgenerated/utils/parallel/Parallel.ts:19

Accessors

py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/utils/parallel/Parallel.ts:35


results

Get Signature

get results(): Promise<any[]>

List of results of the tasks.

Returns Promise<any[]>

Defined in generated/utils/parallel/Parallel.ts:245

Methods

__call__()

__call__(opts): Promise<any[]>

Dispatch the tasks and return the results.

Parameters

ParameterTypeDescription
optsobject-
opts.iterable?anyIterable containing tuples of (delayed_function, args, kwargs) that should be consumed.

Returns Promise<any[]>

Defined in generated/utils/parallel/Parallel.ts:103


dispatch_next()

dispatch_next(opts): Promise<any>

Dispatch more data for parallel processing

This method is meant to be called concurrently by the multiprocessing callback. We rely on the thread-safety of dispatch_one_batch to protect against concurrent consumption of the unprotected iterator.

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/parallel/Parallel.ts:137


dispatch_one_batch()

dispatch_one_batch(opts): Promise<any>

Prefetch the tasks for the next batch and dispatch them.

The effective size of the batch is computed here. If there are no more jobs to dispatch, return false, else return true.

The iterator consumption and dispatching is protected by the same lock so calling this function should be thread safe.

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/parallel/Parallel.ts:167


dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Returns Promise<void>

Defined in generated/utils/parallel/Parallel.ts:86


format()

format(opts): Promise<any>

Return the formatted representation of the object.

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/parallel/Parallel.ts:193


init()

init(py): Promise<void>

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/utils/parallel/Parallel.ts:48


print_progress(opts): Promise<any>

Display the process of the parallel execution only a fraction of time, controlled by self.verbose.

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/utils/parallel/Parallel.ts:219