MCPcopy Create free account
hub / github.com/dchevell/flask-executor / init_app

Method init_app

flask_executor/executor.py:88–106  ·  view source on GitHub ↗

Initialise application. This will also intialise the configured executor type: * :class:`concurrent.futures.ThreadPoolExecutor` * :class:`concurrent.futures.ProcessPoolExecutor`

(self, app)

Source from the content-addressed store, hash-verified

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]

Callers 3

__init__Method · 0.95
test_factory_initFunction · 0.95
test_pre_init_executorFunction · 0.95

Calls 4

_make_executorMethod · 0.95
str2boolFunction · 0.90
default_workersFunction · 0.85

Tested by 2

test_factory_initFunction · 0.76
test_pre_init_executorFunction · 0.76