mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-08 03:48:12 +08:00
Default warning in debug mode (#497)
This commit is contained in:
+1
-4
@@ -1,5 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
import warnings
|
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_caching import Cache
|
from flask_caching import Cache
|
||||||
@@ -8,13 +7,11 @@ from flask_cors import CORS
|
|||||||
from flask_restful_swagger_2 import get_swagger_blueprint
|
from flask_restful_swagger_2 import get_swagger_blueprint
|
||||||
|
|
||||||
from .rest_api.rest import get_api_resources
|
from .rest_api.rest import get_api_resources
|
||||||
from .util.utils import Float32JSONEncoder, custom_format_warning
|
from .util.utils import Float32JSONEncoder
|
||||||
from .web import webapp
|
from .web import webapp
|
||||||
|
|
||||||
REACTIVE_LIMIT = 1_000_000
|
REACTIVE_LIMIT = 1_000_000
|
||||||
|
|
||||||
warnings.formatwarning = custom_format_warning
|
|
||||||
|
|
||||||
app = Flask(__name__, static_folder="web/static")
|
app = Flask(__name__, static_folder="web/static")
|
||||||
app.json_encoder = Float32JSONEncoder
|
app.json_encoder = Float32JSONEncoder
|
||||||
cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000})
|
cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000})
|
||||||
|
|||||||
+10
-5
@@ -1,11 +1,14 @@
|
|||||||
import sys
|
|
||||||
import click
|
|
||||||
import logging
|
import logging
|
||||||
from os import devnull
|
from os import devnull
|
||||||
from os.path import splitext, basename
|
from os.path import splitext, basename
|
||||||
|
import sys
|
||||||
|
import warnings
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
from server.app.util.errors import ScanpyFileError
|
from server.app.util.errors import ScanpyFileError
|
||||||
|
from server.app.util.utils import custom_format_warning
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@@ -48,9 +51,6 @@ def launch(data, layout, diffexp, title, verbose, debug, obs_names, var_names,
|
|||||||
# Startup message
|
# Startup message
|
||||||
click.echo("[cellxgene] Starting the CLI...")
|
click.echo("[cellxgene] Starting the CLI...")
|
||||||
|
|
||||||
# Import Flask app
|
|
||||||
from server.app.app import app
|
|
||||||
|
|
||||||
# Argument checking
|
# Argument checking
|
||||||
name, extension = splitext(data)
|
name, extension = splitext(data)
|
||||||
if extension != ".h5ad":
|
if extension != ".h5ad":
|
||||||
@@ -59,6 +59,8 @@ def launch(data, layout, diffexp, title, verbose, debug, obs_names, var_names,
|
|||||||
if debug:
|
if debug:
|
||||||
verbose = True
|
verbose = True
|
||||||
open_browser = False
|
open_browser = False
|
||||||
|
else:
|
||||||
|
warnings.formatwarning = custom_format_warning
|
||||||
|
|
||||||
if not verbose:
|
if not verbose:
|
||||||
sys.tracebacklimit = 0
|
sys.tracebacklimit = 0
|
||||||
@@ -71,6 +73,9 @@ def launch(data, layout, diffexp, title, verbose, debug, obs_names, var_names,
|
|||||||
cellxgene_url = f"http://{host}:{port}"
|
cellxgene_url = f"http://{host}:{port}"
|
||||||
api_base = f"{cellxgene_url}/api/"
|
api_base = f"{cellxgene_url}/api/"
|
||||||
|
|
||||||
|
# Import Flask app
|
||||||
|
from server.app.app import app
|
||||||
|
|
||||||
app.config.update(
|
app.config.update(
|
||||||
DATASET_TITLE=title,
|
DATASET_TITLE=title,
|
||||||
CXG_API_BASE=api_base
|
CXG_API_BASE=api_base
|
||||||
|
|||||||
Reference in New Issue
Block a user