From 70be44afe18c577d7da94c3420772000d39c2cb8 Mon Sep 17 00:00:00 2001 From: Russell Jurney Date: Wed, 1 May 2019 20:46:39 -0700 Subject: [PATCH] Removed --console-log and superset runserver (#7421) --- CONTRIBUTING.md | 16 -------- requirements-dev.txt | 1 - setup.py | 1 - superset/cli.py | 92 -------------------------------------------- 4 files changed, 110 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdca9cbe24..4fc90570bb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -326,22 +326,6 @@ cd superset FLASK_ENV=development flask run -p 8088 --with-threads --reload --debugger ``` -#### Logging to the browser console - -This feature is only available on Python 3. When debugging your application, you can have the server logs sent directly to the browser console: - -```bash -FLASK_ENV=development flask run -p 8088 --with-threads --reload --debugger --console-log -``` - -You can log anything to the browser console, including objects: - -```python -from superset import app -app.logger.error('An exception occurred!') -app.logger.info(form_data) -``` - ### Frontend Assets Frontend assets (JavaScript, CSS, and images) must be compiled in order to properly display the web UI. The `superset/assets` directory contains all NPM-managed front end assets. Note that there are additional frontend assets bundled with Flask-Appbuilder (e.g. jQuery and bootstrap); these are not managed by NPM, and may be phased out in the future. diff --git a/requirements-dev.txt b/requirements-dev.txt index 1ef6617b5d..857b9ad07d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -console_log==0.2.10 coverage==4.5.3 flake8-commas==2.0.0 flake8-import-order==0.18 diff --git a/setup.py b/setup.py index b97b49ad5b..87f66ab676 100644 --- a/setup.py +++ b/setup.py @@ -108,7 +108,6 @@ setup( ], extras_require={ 'cors': ['flask-cors>=2.0.0'], - 'console_log': ['console_log==0.2.10'], 'hive': [ 'pyhive[hive]>=0.6.1', 'tableschema', diff --git a/superset/cli.py b/superset/cli.py index 1aff4bd44d..e631e0b2ef 100755 --- a/superset/cli.py +++ b/superset/cli.py @@ -24,7 +24,6 @@ from sys import stdout import click from colorama import Fore, Style from pathlib2 import Path -import werkzeug.serving import yaml from superset import ( @@ -54,97 +53,6 @@ def init(): security_manager.sync_role_definitions() -def debug_run(app, port, use_reloader): - click.secho( - '[DEPRECATED] As of Flask >=1.0.0, this command is no longer ' - 'supported, please use `flask run` instead, as documented in our ' - 'CONTRIBUTING.md', - fg='red', - ) - click.secho('[example]', fg='yellow') - click.secho( - 'flask run -p 8080 --with-threads --reload --debugger', - fg='green', - ) - - -def console_log_run(app, port, use_reloader): - from console_log import ConsoleLog - from gevent import pywsgi - from geventwebsocket.handler import WebSocketHandler - - app.wsgi_app = ConsoleLog(app.wsgi_app, app.logger) - - def run(): - server = pywsgi.WSGIServer( - ('0.0.0.0', int(port)), - app, - handler_class=WebSocketHandler) - server.serve_forever() - - if use_reloader: - from gevent import monkey - monkey.patch_all() - run = werkzeug.serving.run_with_reloader(run) - - run() - - -@app.cli.command() -@click.option('--debug', '-d', is_flag=True, help='Start the web server in debug mode') -@click.option('--console-log', is_flag=True, - help='Create logger that logs to the browser console (implies -d)') -@click.option('--no-reload', '-n', 'use_reloader', flag_value=False, - default=config.get('FLASK_USE_RELOAD'), - help='Don\'t use the reloader in debug mode') -@click.option('--address', '-a', default=config.get('SUPERSET_WEBSERVER_ADDRESS'), - help='Specify the address to which to bind the web server') -@click.option('--port', '-p', default=config.get('SUPERSET_WEBSERVER_PORT'), - help='Specify the port on which to run the web server') -@click.option('--workers', '-w', default=config.get('SUPERSET_WORKERS', 2), - help='Number of gunicorn web server workers to fire up [DEPRECATED]') -@click.option('--timeout', '-t', default=config.get('SUPERSET_WEBSERVER_TIMEOUT'), - help='Specify the timeout (seconds) for the ' - 'gunicorn web server [DEPRECATED]') -@click.option('--socket', '-s', 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. [DEPRECATED]') -def runserver(debug, console_log, use_reloader, address, port, timeout, workers, socket): - """Starts a Superset web server.""" - debug = debug or config.get('DEBUG') or console_log - if debug: - print(Fore.BLUE + '-=' * 20) - print( - Fore.YELLOW + 'Starting Superset server in ' + - Fore.RED + 'DEBUG' + - Fore.YELLOW + ' mode') - print(Fore.BLUE + '-=' * 20) - print(Style.RESET_ALL) - if console_log: - console_log_run(app, port, use_reloader) - else: - debug_run(app, port, use_reloader) - else: - logging.info( - "The Gunicorn 'superset runserver' command is deprecated. Please " - "use the 'gunicorn' command instead.") - addr_str = f' unix:{socket} ' if socket else f' {address}:{port} ' - cmd = ( - 'gunicorn ' - f'-w {workers} ' - f'--timeout {timeout} ' - f'-b {addr_str} ' - '--limit-request-line 0 ' - '--limit-request-field_size 0 ' - 'superset:app' - ) - print(Fore.GREEN + 'Starting server with command: ') - print(Fore.YELLOW + cmd) - print(Style.RESET_ALL) - Popen(cmd, shell=True).wait() - - @app.cli.command() @click.option('--verbose', '-v', is_flag=True, help='Show extra information') def version(verbose):