Asynchronous get function This is a general version of various asynchronous schedulers for dask. It takes a ``concurrent.futures.Executor.submit`` function to form a more specific ``get`` method that walks through the dask array with parallel workers, avoiding repeat computation an
(
submit,
num_workers,
dsk,
result,
cache=None,
get_id=default_get_id,
rerun_exceptions_locally=None,
pack_exception=default_pack_exception,
raise_exception=reraise,
callbacks=None,
dumps=identity,
loads=identity,
chunksize=None,
**kwargs,
)
| 380 | |
| 381 | |
| 382 | def get_async( |
| 383 | submit, |
| 384 | num_workers, |
| 385 | dsk, |
| 386 | result, |
| 387 | cache=None, |
| 388 | get_id=default_get_id, |
| 389 | rerun_exceptions_locally=None, |
| 390 | pack_exception=default_pack_exception, |
| 391 | raise_exception=reraise, |
| 392 | callbacks=None, |
| 393 | dumps=identity, |
| 394 | loads=identity, |
| 395 | chunksize=None, |
| 396 | **kwargs, |
| 397 | ): |
| 398 | """Asynchronous get function |
| 399 | |
| 400 | This is a general version of various asynchronous schedulers for dask. It |
| 401 | takes a ``concurrent.futures.Executor.submit`` function to form a more |
| 402 | specific ``get`` method that walks through the dask array with parallel |
| 403 | workers, avoiding repeat computation and minimizing memory use. |
| 404 | |
| 405 | Parameters |
| 406 | ---------- |
| 407 | submit : function |
| 408 | A ``concurrent.futures.Executor.submit`` function |
| 409 | num_workers : int |
| 410 | The number of workers that task submissions can be spread over |
| 411 | dsk : dict |
| 412 | A dask dictionary specifying a workflow |
| 413 | result : key or list of keys |
| 414 | Keys corresponding to desired data |
| 415 | cache : dict-like, optional |
| 416 | Temporary storage of results |
| 417 | get_id : callable, optional |
| 418 | Function to return the worker id, takes no arguments. Examples are |
| 419 | `threading.current_thread` and `multiprocessing.current_process`. |
| 420 | rerun_exceptions_locally : bool, optional |
| 421 | Whether to rerun failing tasks in local process to enable debugging |
| 422 | (False by default) |
| 423 | pack_exception : callable, optional |
| 424 | Function to take an exception and ``dumps`` method, and return a |
| 425 | serialized tuple of ``(exception, traceback)`` to send back to the |
| 426 | scheduler. Default is to just raise the exception. |
| 427 | raise_exception : callable, optional |
| 428 | Function that takes an exception and a traceback, and raises an error. |
| 429 | callbacks : tuple or list of tuples, optional |
| 430 | Callbacks are passed in as tuples of length 5. Multiple sets of |
| 431 | callbacks may be passed in as a list of tuples. For more information, |
| 432 | see the dask.diagnostics documentation. |
| 433 | dumps: callable, optional |
| 434 | Function to serialize task data and results to communicate between |
| 435 | worker and parent. Defaults to identity. |
| 436 | loads: callable, optional |
| 437 | Inverse function of `dumps`. Defaults to identity. |
| 438 | chunksize: int, optional |
| 439 | Size of chunks to use when dispatching work. Defaults to 1. |
no test coverage detected
searching dependent graphs…