[cli] Deprecating gunicorn/flower dependencies (#4451)

This commit is contained in:
John Bodley 2018-03-30 09:28:16 -07:00 committed by GitHub
parent e25535c693
commit b3442a7b53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 22 deletions

View File

@ -125,10 +125,7 @@ Follow these few simple steps to install Superset.::
# Create default roles and permissions
superset init
# Start the web server on port 8088, use -p to bind to another port
superset runserver
# To start a development web server, use the -d switch
# To start a development web server on port 8088, use -p to bind to another port
# superset runserver -d
@ -147,12 +144,8 @@ Gunicorn, preferably in **async mode**, which allows for impressive
concurrency even and is fairly easy to install and configure. Please
refer to the
documentation of your preferred technology to set up this Flask WSGI
application in a way that works well in your environment.
While the `superset runserver` command act as an quick wrapper
around `gunicorn`, it doesn't expose all the options you may need,
so you'll want to craft your own `gunicorn` command in your production
environment. Here's an **async** setup known to work well: ::
application in a way that works well in your environment. Here's an **async**
setup known to work well in production: ::
 gunicorn \
-w 10 \
@ -165,7 +158,7 @@ environment. Here's an **async** setup known to work well: ::
superset:app
Refer to the
[Gunicorn documentation](http://docs.gunicorn.org/en/stable/design.html)
`Gunicorn documentation <http://docs.gunicorn.org/en/stable/design.html>`_
for more information.
Note that *gunicorn* does not
@ -228,7 +221,6 @@ of the parameters you can copy / paste in that configuration module: ::
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 5000
SUPERSET_WORKERS = 4
SUPERSET_WEBSERVER_PORT = 8088
#---------------------------------------------------------
@ -503,8 +495,8 @@ execute beyond the typical web request's timeout (30-60 seconds), it is
necessary to configure an asynchronous backend for Superset which consist of:
* one or many Superset worker (which is implemented as a Celery worker), and
can be started with the ``superset worker`` command, run
``superset worker --help`` to view the related options
can be started with the ``celery worker`` command, run
``celery worker --help`` to view the related options.
* a celery broker (message queue) for which we recommend using Redis
or RabbitMQ
* a results backend that defines where the worker will persist the query
@ -524,6 +516,10 @@ have the same configuration.
CELERY_CONFIG = CeleryConfig
To start a Celery worker to leverage the configuration run: ::
celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair
To setup a result backend, you need to pass an instance of a derivative
of ``werkzeug.contrib.cache.BaseCache`` to the ``RESULTS_BACKEND``
configuration key in your ``superset_config.py``. It's possible to use
@ -564,6 +560,15 @@ in this dictionary are made available for users to use in their SQL.
}
Flower is a web based tool for monitoring the Celery cluster which you can
install from pip: ::
pip install flower
and run via: ::
celery flower --app=superset.sql_lab:celery_app
Making your own build
---------------------

View File

@ -63,12 +63,12 @@ setup(
'flask-sqlalchemy==2.1',
'flask-testing==0.7.1',
'flask-wtf==0.14.2',
'flower==0.9.2',
'flower==0.9.2', # deprecated
'future>=0.16.0, <0.17',
'geopy==1.11.0',
'python-geohash==0.8.5',
'humanize==0.5.1',
'gunicorn==19.7.1',
'gunicorn==19.7.1', # deprecated
'idna==2.6',
'markdown==2.6.11',
'pandas==0.22.0',

View File

@ -48,15 +48,15 @@ def init():
@manager.option(
'-w', '--workers',
default=config.get('SUPERSET_WORKERS', 2),
help='Number of gunicorn web server workers to fire up')
help='Number of gunicorn web server workers to fire up [DEPRECATED]')
@manager.option(
'-t', '--timeout', default=config.get('SUPERSET_WEBSERVER_TIMEOUT'),
help='Specify the timeout (seconds) for the gunicorn web server')
help='Specify the timeout (seconds) for the gunicorn web server [DEPRECATED]')
@manager.option(
'-s', '--socket', default=config.get('SUPERSET_WEBSERVER_SOCKET'),
help='Path to a UNIX socket as an alternative to address:port, e.g. '
'/var/run/superset.sock. '
'Will override the address and port values.')
'Will override the address and port values. [DEPRECATED]')
def runserver(debug, use_reloader, address, port, timeout, workers, socket):
"""Starts a Superset web server."""
debug = debug or config.get('DEBUG')
@ -75,6 +75,9 @@ def runserver(debug, use_reloader, address, port, timeout, workers, socket):
debug=True,
use_reloader=use_reloader)
else:
logging.info(
"The Gunicorn 'superset runserver' command is deprecated. Please "
"use the 'gunicorn' command instead.")
addr_str = ' unix:{socket} ' if socket else' {address}:{port} '
cmd = (
'gunicorn '
@ -285,6 +288,9 @@ def update_datasources_cache():
help='Number of celery server workers to fire up')
def worker(workers):
"""Starts a Superset worker for async SQL query execution."""
logging.info(
"The 'superset worker' command is deprecated. Please use the 'celery "
"worker' command instead.")
if workers:
celery_app.conf.update(CELERYD_CONCURRENCY=workers)
elif config.get('SUPERSET_CELERY_WORKERS'):
@ -315,6 +321,9 @@ def flower(port, address):
'--port={port} '
'--address={address} '
).format(**locals())
logging.info(
"The 'superset flower' command is deprecated. Please use the 'celery "
"flower' command instead.")
print(Fore.GREEN + 'Starting a Celery Flower instance')
print(Fore.BLUE + '-=' * 40)
print(Fore.YELLOW + cmd)

View File

@ -42,12 +42,12 @@ ROW_LIMIT = 50000
VIZ_ROW_LIMIT = 10000
# max rows retrieved by filter select auto complete
FILTER_SELECT_ROW_LIMIT = 10000
SUPERSET_WORKERS = 2
SUPERSET_CELERY_WORKERS = 32
SUPERSET_WORKERS = 2 # deprecated
SUPERSET_CELERY_WORKERS = 32 # deprecated
SUPERSET_WEBSERVER_ADDRESS = '0.0.0.0'
SUPERSET_WEBSERVER_PORT = 8088
SUPERSET_WEBSERVER_TIMEOUT = 60
SUPERSET_WEBSERVER_TIMEOUT = 60 # deprecated
EMAIL_NOTIFICATIONS = False
CUSTOM_SECURITY_MANAGER = None
SQLALCHEMY_TRACK_MODIFICATIONS = False