You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to setup a flask app with some shared data using multiprocessing.Manager.
doing so I encounter something similar to #1391 (which is not related to gunicorn), one of the solution pointed in the issue si to use hooks to remove exit handlers.
The issue I have is that I'm not able to get those hooks configured.
class StandaloneApplication(gunicorn.app.base.BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
config = {key: value for key, value in self.options.items()
if key in self.cfg.settings and value is not None}
for key, value in config.items():
self.cfg.set(key.lower(), value)
def load(self):
return self.application
# We check if we are running directly or not
if __name__ == '__main__':
manager = BaseManager(address=('', 9000), authkey=None)
manager.start()
app.logger.info(f'Db listening @ {manager.address}')
app.logger.info("Starting shared db")
options = {
'bind': '%s:%s' % ('127.0.0.1', '9091'),
'workers': number_of_workers(),
'config': './gunicorn.conf.py',
}
# gunicorn starts here
StandaloneApplication(app, options).run()
Seems to have no effect (to be sure a set conf file to something inexistsant).
Could you point me a way to do this? Either by settting the config file, or by overloading soemthing in base app.
For the reccords I've tried the same code but inheriting from gunicorn.app.base.Application, but got the same result.
This discussion was converted from issue #3066 on December 29, 2023 04:27.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm trying to setup a flask app with some shared data using multiprocessing.Manager.
doing so I encounter something similar to #1391 (which is not related to gunicorn), one of the solution pointed in the issue si to use hooks to remove exit handlers.
The issue I have is that I'm not able to get those hooks configured.
Seems to have no effect (to be sure a set conf file to something inexistsant).
Could you point me a way to do this? Either by settting the config file, or by overloading soemthing in base app.
For the reccords I've tried the same code but inheriting from gunicorn.app.base.Application, but got the same result.
Regards.
Beta Was this translation helpful? Give feedback.
All reactions