Commit 03b999cb authored by Zixian Cai's avatar Zixian Cai

Cleanup web related code

parent c0dc1515
......@@ -15,7 +15,7 @@
import logging
from mubench.models.pipeline import pipelines
from mubench.util import get_cpu_info, get_hostname, get_uname, get_zebu_ver
from mubench.utils import get_cpu_info, get_hostname, get_uname, get_zebu_ver
from collections import defaultdict
from mubench.models.trails import Trails
......
......@@ -20,7 +20,6 @@ import click
import json
app = Flask(__name__)
app.config['DEBUG'] = settings.WEB_DEBUG
app.config['SECRET_KEY'] = settings.WEB_SECRET
......@@ -32,7 +31,8 @@ def visualize():
logfile = request.files["logfile"]
result = json.loads(logfile.read())
for ts in result["ts"]:
ts["datapoints_grouped"] = {k: group_stats(v) for k, v in ts["datapoints"].items()}
ts["datapoints_grouped"] = {k: group_stats(v) for k, v in
ts["datapoints"].items()}
ts["metrics"] = iter(ts["datapoints"].values()).__next__()[0].keys()
return render_template("visualize.html", result=result)
......@@ -43,5 +43,8 @@ def index():
@click.command()
def web():
app.run()
@click.option("--host", default="localhost")
@click.option("--port", default=5000, type=int)
@click.option("--debug", default=False)
def web(host, port, debug):
app.run(host=host, port=port, debug=debug)
......@@ -18,8 +18,8 @@ import time
from pathlib import Path
from mubench import CALLBACKS_DIR
from mubench.util import expandenv
from mubench.util import run_in_subproc
from mubench.utils import expandenv
from mubench.utils import run_in_subproc
class Language:
name = None
......
......@@ -17,7 +17,7 @@ import os
from mubench.lang import Language
from mubench import CALLBACKS_DIR
from mubench.util import expandenv, run_in_subproc
from mubench.utils import expandenv, run_in_subproc
class C(Language):
......
......@@ -19,7 +19,7 @@ from pathlib import Path
from mubench.lang import Language
from mubench import CALLBACKS_DIR
from mubench.util import expandenv, run_in_subproc
from mubench.utils import expandenv, run_in_subproc
class Mu(Language):
......
......@@ -18,7 +18,7 @@ import os
from mubench import CALLBACKS_DIR
from mubench.lang import Language
from mubench.util import expandenv, run_in_subproc
from mubench.utils import expandenv, run_in_subproc
class Python(Language):
......
......@@ -20,8 +20,8 @@ from pathlib import Path
from mubench.lang import Language
from mubench import CALLBACKS_DIR
from mubench.util import expandenv, run_in_subproc
from mubench.util import add_path_to_ld_library_path
from mubench.utils import expandenv, run_in_subproc
from mubench.utils import add_path_to_ld_library_path
class RPython(Language):
......
......@@ -19,7 +19,7 @@ import subprocess as subproc
from mubench.lang import Language
from mubench import CALLBACKS_DIR
from mubench.util import expandenv, run_in_subproc
from mubench.utils import expandenv, run_in_subproc
from types import SimpleNamespace
logger = logging.getLogger(__name__)
......
......@@ -21,7 +21,7 @@ from pathlib import Path
import crayons
from mubench import CALLBACKS_DIR
from mubench.util import expandenv, run_in_subproc, ExecutionFailure
from mubench.utils import expandenv, run_in_subproc, ExecutionFailure
logger = logging.getLogger(__name__)
......
......@@ -25,8 +25,8 @@ from types import SimpleNamespace
from mubench import SUITE_DIR, CALLBACKS_DIR
from mubench.conf import settings
from mubench.util import expandenv, dictify, run_in_subproc, ExecutionFailure
from mubench.util import add_path_to_ld_library_path
from mubench.utils import expandenv, dictify, run_in_subproc, ExecutionFailure
from mubench.utils import add_path_to_ld_library_path
from mubench.lang import get_lang, Language
from mubench.models.trails import Trails
from mubench.models.callback import CALLBACK_BY_NAME
......
#!/usr/bin/env python3
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment