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.
Constructors
new Parallel()
new Parallel(
opts?):Parallel
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | object | - |
opts.iterable? | any | Iterable containing tuples of (delayed_function, args, kwargs) that should be consumed. |
Returns Parallel
Defined in generated/utils/parallel/Parallel.ts:25
Properties
| Property | Type | Default value | Defined in |
|---|---|---|---|
_isDisposed | boolean | false | generated/utils/parallel/Parallel.ts:23 |
_isInitialized | boolean | false | generated/utils/parallel/Parallel.ts:22 |
_py | PythonBridge | undefined | generated/utils/parallel/Parallel.ts:21 |
id | string | undefined | generated/utils/parallel/Parallel.ts:18 |
opts | any | undefined | generated/utils/parallel/Parallel.ts:19 |
Accessors
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge):void
Parameters
| Parameter | Type |
|---|---|
pythonBridge | PythonBridge |
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
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.iterable? | any | Iterable 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
| Parameter | Type |
|---|---|
opts | object |
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
| Parameter | Type |
|---|---|
opts | object |
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
| Parameter | Type |
|---|---|
opts | object |
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
| Parameter | Type |
|---|---|
py | PythonBridge |
Returns Promise<void>
Defined in generated/utils/parallel/Parallel.ts:48
print_progress()
print_progress(
opts):Promise<any>
Display the process of the parallel execution only a fraction of time, controlled by self.verbose.
Parameters
| Parameter | Type |
|---|---|
opts | object |
Returns Promise<any>
Defined in generated/utils/parallel/Parallel.ts:219