gunicorn: allow to change the worker class and timeout

By design, gunicorn spawns a master and N workers. The master send regular ping
messages to the workers. When a worker is not answering to ping message for
TIMEOUT seconds, then the master kill the worker, aborting the current
requests.

By default gunicorn is using the "sync" worker which is not suitable for long
requests like downloading large log files. In fact the worker will block during
the whole duration of the request and won't answer to the gunicorn master ping.
After 30 seconds (default timeout) the master will kill the worker, aborting
the request.

When using an async worker (like eventlet), the worker can process multiple
long running requests at the same time while answering to master pings.  In
this case, requests are not aborteed after TIMEOUT seconds, allowing to
download large log files.

This patch allows to change the worker class and the timeout while keeping the
current default (sync worker and a timeout of 30 seconds).

In order to use eventlet, admins should install python3-eventlet, update the
configuration and restart lava-server-gunicorn.

Signed-off-by: Rémi Duraffort <remi.duraffort@linaro.org>
15 jobs for gunicorn-worker-class in 19 minutes and 16 seconds (queued for 3 seconds)
Status Job ID Name Coverage
  Test
passed #104078
amd64
dispatcher-debian-10

00:03:59

passed #104080
amd64
dispatcher-debian-11

00:04:14

passed #104079
amd64
server-debian-10

00:04:33

passed #104081
amd64
server-debian-11

00:07:02

 
  Analyze
passed #104082
amd64-dind
bandit-sast

00:01:24

passed #104083
amd64
black

00:01:15

passed #104084
amd64
code_quality

00:00:39

passed #104085
amd64
coverage

00:06:53

59.33%
passed #104086
amd64
dockerfiles

00:00:36

passed #104088
amd64
pylint

00:03:24

passed #104087
amd64
schemas

00:00:55

 
  Build
passed #104090
amd64
debian/10

00:02:35

passed #104089
amd64
doc

00:01:33

passed #104091
amd64-dind
docker-amd64-dispatcher

00:05:00

passed #104092
amd64-dind
docker-amd64-server

00:05:16