Skip to content

Commit

Permalink
Rename no_reload (apache#4703)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida authored and timifasubaa committed May 31, 2018
1 parent ff4b103 commit be897ac
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
33 changes: 20 additions & 13 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h' # noqa

# The SQLAlchemy connection string.
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(DATA_DIR, 'superset.db')
# SQLALCHEMY_DATABASE_URI = 'mysql://myapp@localhost/myapp'
#SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(DATA_DIR, 'superset.db')
SQLALCHEMY_DATABASE_URI = 'mysql://root@localhost/superset_development'
# SQLALCHEMY_DATABASE_URI = 'postgresql://root:password@localhost/myapp'

# In order to hook up a custom password store for all SQLACHEMY connections
Expand Down Expand Up @@ -247,7 +247,7 @@
BACKUP_COUNT = 30

# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = os.environ.get('MAPBOX_API_KEY', '')
MAPBOX_API_KEY = ''

# Maximum number of rows returned in the SQL editor
SQL_MAX_ROW = 1000000
Expand All @@ -264,19 +264,23 @@
# Default celery config is to use SQLA as a broker, in a production setting
# you'll want to use a proper broker as specified here:
# http://docs.celeryproject.org/en/latest/getting-started/brokers/index.html
"""

# Example:
class CeleryConfig(object):
BROKER_URL = 'sqla+sqlite:///celerydb.sqlite'
CELERY_IMPORTS = ('superset.sql_lab', )
CELERY_RESULT_BACKEND = 'db+sqlite:///celery_results.sqlite'
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
CELERYD_LOG_LEVEL = 'DEBUG'
CELERYD_PREFETCH_MULTIPLIER = 1
CELERY_ACKS_LATE = True
BROKER_URL = 'redis://localhost:6379'
CELERY_IMPORTS = ('superset.sql_lab', )
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
CELERYD_LOG_LEVEL = 'DEBUG'
CELERYD_PREFETCH_MULTIPLIER = 1
CELERYD_CONCURRENCY = 16
CELERY_ACKS_LATE = True
STATSD_HOST = 'localhost'
STATSD_PORT = 8125
CELERY_CONFIG = CeleryConfig
"""
CELERY_CONFIG = None
"""
SQL_CELERY_DB_FILE_PATH = os.path.join(DATA_DIR, 'celerydb.sqlite')
SQL_CELERY_RESULTS_DB_FILE_PATH = os.path.join(DATA_DIR, 'celery_results.sqlite')

Expand Down Expand Up @@ -304,7 +308,10 @@ class CeleryConfig(object):
# An instantiated derivative of werkzeug.contrib.cache.BaseCache
# if enabled, it can be used to store the results of long-running queries
# in SQL Lab by using the "Run Async" button/feature
RESULTS_BACKEND = None
from s3cache.s3cache import S3Cache
S3_CACHE_BUCKET = 'airbnb-superset'
S3_CACHE_KEY_PREFIX = 'sql_lab_result'
RESULTS_BACKEND = S3Cache(S3_CACHE_BUCKET, S3_CACHE_KEY_PREFIX)

# The S3 bucket where you want to store your external hive tables created
# from CSV files. For example, 'companyname-superset'
Expand Down Expand Up @@ -433,4 +440,4 @@ class CeleryConfig(object):
print('Loaded your LOCAL configuration at [{}]'.format(
superset_config.__file__))
except ImportError:
pass
pass
7 changes: 6 additions & 1 deletion superset/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,9 @@ def handle_cursor(cls, cursor, query, session):
while polled:
# Update the object and wait for the kill signal.
stats = polled.get('stats', {})

print(stats)
print(dir(stats))
print("????")
query = session.query(type(query)).filter_by(id=query.id).one()
if query.status in [QueryStatus.STOPPED, QueryStatus.TIMED_OUT]:
cursor.cancel()
Expand Down Expand Up @@ -1071,6 +1073,9 @@ def handle_cursor(cls, cursor, query, session):
hive.ttypes.TOperationState.RUNNING_STATE,
)
polled = cursor.poll()
print("~~~~~~~~~~~~~~~")
print(polled)
print(dir(polled))
last_log_line = 0
tracking_url = None
job_id = None
Expand Down
2 changes: 1 addition & 1 deletion superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def get_sql_results(
except Exception as e:
logging.exception(e)
stats_logger.incr('error_sqllab_unhandled')
sesh = get_session(not ctask.request.called_directly)
query = get_query(query_id, session)
query.error_message = str(e)
query.status = QueryStatus.FAILED
Expand All @@ -141,7 +142,6 @@ def execute_sql(
user_name=None, session=None,
):
"""Executes the sql query returns the results."""

query = get_query(query_id, session)
payload = dict(query_id=query_id)

Expand Down
1 change: 1 addition & 0 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2538,6 +2538,7 @@ def fetch_datasource_metadata(self):
@expose('/queries/<last_updated_ms>')
def queries(self, last_updated_ms):
"""Get the updated queries."""
print("frontend is checking!!~~~~~~")
stats_logger.incr('queries')
if not g.user.get_id():
return json_error_response(
Expand Down

0 comments on commit be897ac

Please sign in to comment.