Submit a new function job to the pool Parameters ---------- fn : function The function to be invoked. args : list Positional argument. kwargs : dict Keyword arguments Returns ------- future : conc
(self, fn, *args, **kwargs)
| 441 | return MapResult(status=StatusKind.EXCEPTION, value=exception) |
| 442 | |
| 443 | def submit(self, fn, *args, **kwargs) -> concurrent.futures.Future: |
| 444 | """Submit a new function job to the pool |
| 445 | |
| 446 | Parameters |
| 447 | ---------- |
| 448 | fn : function |
| 449 | The function to be invoked. |
| 450 | |
| 451 | args : list |
| 452 | Positional argument. |
| 453 | |
| 454 | kwargs : dict |
| 455 | Keyword arguments |
| 456 | |
| 457 | Returns |
| 458 | ------- |
| 459 | future : concurrent.futures.Future |
| 460 | A future that can be used to access the result. |
| 461 | """ |
| 462 | # pylint: disable=unnecessary-lambda |
| 463 | worker = lambda *args: self._worker_run(*args) |
| 464 | return self._threadpool.submit(worker, fn, args, kwargs) |
| 465 | |
| 466 | def map_with_error_catching(self, fn, iterator): |
| 467 | """Same as map, but catches exceptions and return them instead. |