Initialise application. This will also intialise the configured executor type: * :class:`concurrent.futures.ThreadPoolExecutor` * :class:`concurrent.futures.ProcessPoolExecutor`
(self, app)
| 86 | self.init_app(app) |
| 87 | |
| 88 | def init_app(self, app): |
| 89 | """Initialise application. This will also intialise the configured |
| 90 | executor type: |
| 91 | |
| 92 | * :class:`concurrent.futures.ThreadPoolExecutor` |
| 93 | * :class:`concurrent.futures.ProcessPoolExecutor` |
| 94 | """ |
| 95 | app.config.setdefault(self.EXECUTOR_TYPE, 'thread') |
| 96 | executor_type = app.config[self.EXECUTOR_TYPE] |
| 97 | executor_max_workers = default_workers(executor_type) |
| 98 | app.config.setdefault(self.EXECUTOR_MAX_WORKERS, executor_max_workers) |
| 99 | futures_max_length = app.config.setdefault(self.EXECUTOR_FUTURES_MAX_LENGTH, None) |
| 100 | propagate_exceptions = app.config.setdefault(self.EXECUTOR_PROPAGATE_EXCEPTIONS, False) |
| 101 | if futures_max_length is not None: |
| 102 | self.futures.max_length = int(futures_max_length) |
| 103 | if str2bool(propagate_exceptions): |
| 104 | self.add_default_done_callback(propagate_exceptions_callback) |
| 105 | self._self = self._make_executor(app) |
| 106 | app.extensions[self.name + 'executor'] = self |
| 107 | |
| 108 | def _make_executor(self, app): |
| 109 | executor_type = app.config[self.EXECUTOR_TYPE] |