Adding argparse for port and debug mode on bin/panoramix
This commit is contained in:
parent
483935cc12
commit
6dd81a3e95
|
|
@ -1,19 +1,30 @@
|
|||
#!/usr/bin/env python
|
||||
from panoramix import app, config
|
||||
from subprocess import Popen
|
||||
import argparse
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if config.DEBUG:
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Start a Panoramix web server')
|
||||
parser.add_argument(
|
||||
'-d', '--debug', action='store_true',
|
||||
help="Start the web server in debug mode")
|
||||
parser.add_argument(
|
||||
'-p', '--port', default=config.PANORAMIX_WEBSERVER_PORT,
|
||||
help="Specify the port on which to run the web server")
|
||||
args = parser.parse_args()
|
||||
args.debug = args.debug or config.DEBUG
|
||||
if args.debug:
|
||||
app.run(
|
||||
host='0.0.0.0',
|
||||
port=int(config.PANORAMIX_WEBSERVER_PORT),
|
||||
port=int(args.port),
|
||||
debug=True)
|
||||
else:
|
||||
cmd = (
|
||||
"gunicorn "
|
||||
"-w 8 "
|
||||
"-b 0.0.0.0:{config.PANORAMIX_WEBSERVER_PORT} "
|
||||
"-b 0.0.0.0:{args.port} "
|
||||
"panoramix:app").format(**locals())
|
||||
print("Starting server with command: " + cmd)
|
||||
Popen(cmd, shell=True).wait()
|
||||
|
|
|
|||
|
|
@ -390,6 +390,10 @@ class TableColumn(Model, AuditMixin):
|
|||
def __repr__(self):
|
||||
return self.column_name
|
||||
|
||||
@property
|
||||
def isnum(self):
|
||||
return self.type in ('LONG', 'DOUBLE', 'FLOAT')
|
||||
|
||||
class Cluster(Model, AuditMixin):
|
||||
__tablename__ = 'clusters'
|
||||
id = Column(Integer, primary_key=True)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class TableColumnInlineView(CompactCRUDMixin, ModelView):
|
|||
datamodel = SQLAInterface(models.TableColumn)
|
||||
can_delete = False
|
||||
edit_columns = [
|
||||
'column_name', 'description', 'table', 'groupby', 'filterable',
|
||||
'column_name', 'description', 'groupby', 'filterable', 'table',
|
||||
'count_distinct', 'sum', 'min', 'max']
|
||||
list_columns = [
|
||||
'column_name', 'type', 'groupby', 'filterable', 'count_distinct',
|
||||
|
|
@ -63,7 +63,7 @@ class SqlMetricInlineView(CompactCRUDMixin, ModelView):
|
|||
list_columns = ['metric_name', 'verbose_name', 'metric_type' ]
|
||||
edit_columns = [
|
||||
'metric_name', 'description', 'verbose_name', 'metric_type',
|
||||
'table', 'expression']
|
||||
'expression', 'table',]
|
||||
add_columns = edit_columns
|
||||
page_size = 100
|
||||
appbuilder.add_view_no_menu(SqlMetricInlineView)
|
||||
|
|
|
|||
Loading…
Reference in New Issue