From 1fcd4acb08cefdbbe94afc3d43ac9d130cd44c6f Mon Sep 17 00:00:00 2001 From: jortencio <87046872+jortencio@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:17:41 +1000 Subject: [PATCH] Feature add support for gunicorn worker class (#21) * Add support for other gunicorn worker types * Remove gthread worker_class --- manifests/init.pp | 2 +- manifests/install.pp | 6 +++++- templates/superset.gunicorn.epp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 6a29460..8e62627 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -151,7 +151,7 @@ String $admin_lastname = 'admin', String $admin_email = 'admin@mycompany.com', String $gunicorn_install_dir = '/home/superset', - String $gunicorn_worker_class = 'gevent', + Enum['sync','eventlet','gevent','tornado'] $gunicorn_worker_class = 'gevent', Integer $gunicorn_workers = 10, Integer $gunicorn_timeout = 120, String $gunicorn_bind = '0.0.0.0:8088', diff --git a/manifests/install.pp b/manifests/install.pp index 8e0a20d..e82a158 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -92,7 +92,11 @@ # Install python libraries for managing the webserver if $superset::manage_webserver { - $webserver_venv_pip_pkg = ['gunicorn', 'gevent'] + if $superset::gunicorn_worker_class == 'sync' { + $webserver_venv_pip_pkg = ['gunicorn'] + } else { + $webserver_venv_pip_pkg = ['gunicorn', $superset::gunicorn_worker_class] + } $webserver_venv_pip_pkg.each | String $pkgname | { python::pip { $pkgname: ensure => 'present', diff --git a/templates/superset.gunicorn.epp b/templates/superset.gunicorn.epp index 1f00b32..811d4bf 100644 --- a/templates/superset.gunicorn.epp +++ b/templates/superset.gunicorn.epp @@ -1,7 +1,7 @@ <%- | String $install_dir, Integer $workers, - Enum['sync','eventlet','gevent','tornado','gthread'] $worker_class, + Enum['sync','eventlet','gevent','tornado'] $worker_class, String $bind, Integer $timeout, Integer $limit_request_line,