Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] Preparing to deprecate wrapping of external commands #4451

Merged
merged 2 commits into from
Mar 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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 \
Copy link
Contributor

@fabianmenges fabianmenges Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are running gunicorn with gevent which make superset more efficient handling requests -k gevent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabianmenges the -k gevent argument is specified.

-w 10 \
Expand All @@ -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
Expand Down Expand Up @@ -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
#---------------------------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
---------------------

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def get_git_sha():
'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',
Expand Down
15 changes: 12 additions & 3 deletions superset/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 '
Expand Down Expand Up @@ -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'):
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: would these configs (and the rest of the config vars that are only used in cli.py also be tagged as # deprecated?

Copy link
Member Author

@john-bodley john-bodley Mar 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffreythewang I added SUPERSET_WEBSERVER_TIMEOUT. Am I missing other config variables from the commands which are slated to be deprecated?

Copy link
Contributor

@jeffreythewang jeffreythewang Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response. I primarily meant it as adding a # deprecated and [DEPRECATED] comment, both in cli.py and the sample config.py, to the environment variables that are deprecated. I might be wrong, but I only see SUPERSET_WEBSERVER_PORT, SUPERSET_WEBSERVER_ADDRESS, and FLASK_USE_RELOAD used in cli.py.

SUPERSET_WEBSERVER_TIMEOUT = 60
SUPERSET_WEBSERVER_TIMEOUT = 60 # deprecated
EMAIL_NOTIFICATIONS = False
CUSTOM_SECURITY_MANAGER = None
SQLALCHEMY_TRACK_MODIFICATIONS = False
Expand Down