| 106 | app.extensions[self.name + 'executor'] = self |
| 107 | |
| 108 | def _make_executor(self, app): |
| 109 | executor_type = app.config[self.EXECUTOR_TYPE] |
| 110 | executor_max_workers = app.config[self.EXECUTOR_MAX_WORKERS] |
| 111 | if executor_max_workers is not None: |
| 112 | executor_max_workers = int(executor_max_workers) |
| 113 | if executor_type == 'thread': |
| 114 | _executor = concurrent.futures.ThreadPoolExecutor |
| 115 | elif executor_type == 'process': |
| 116 | _executor = concurrent.futures.ProcessPoolExecutor |
| 117 | else: |
| 118 | raise ValueError("{} is not a valid executor type.".format(executor_type)) |
| 119 | return _executor(max_workers=executor_max_workers) |
| 120 | |
| 121 | def _prepare_fn(self, fn, force_copy=False): |
| 122 | if isinstance(self._self, concurrent.futures.ThreadPoolExecutor) \ |