redirectory.libs_int.service.gunicorn_server module

class redirectory.libs_int.service.gunicorn_server.GunicornServer(app, options=None)[source]

Bases: gunicorn.app.base.BaseApplication

This class provides the ability to run gunicorn server from inside of python instead of the running it through the command prompt Gives you a nicer way to handle it and you can override key methods to make it more specific for our use case

static get_number_of_workers(is_worker: bool = False)[source]

Calculates the number of workers the gunicorn server will use

init(parser, opts, args)[source]
load()[source]
load_config()[source]

This method is used to load the configuration from one or several input(s). Custom Command line, configuration file. You have to override this method in your class.

static load_metric_server()[source]

When run() is called on Gunicorn it starts a new process with this flask App. The metric server must run in the same process as the Flask API in order to share the metrics. This function starts the metric server when the Flask APP is loaded into the new process.