WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit b3118de3 authored by Zixian Cai's avatar Zixian Cai
Browse files

馃帹 make running local config files as a frontend command

parent 90038675
import sys
import argparse
import logging
import click
from mubench import __VERSION__
from mubench.driver import handle_local, handle_frontend
from mubench.frontend import frontends
assert sys.version_info[:2] >= (3, 4), "Python 3.4+ is required."
logging.basicConfig(
format="[%(levelname)s] %(asctime)s %(module)s %(message)s")
logging.basicConfig(level=logging.INFO)
format="[%(levelname)s] %(asctime)s %(module)s %(message)s",
level=logging.INFO)
def parse_args():
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
group.add_argument("--file",
metavar="PATH",
help="Run tasks in a file")
group.add_argument("--frontend",
help="Launch frontend functionality")
parser.add_argument('--version',
action='version',
version=__VERSION__)
return parser.parse_args()
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo("Mu Performance Benchmarking Framework\n"
"Version: {}".format(__VERSION__))
ctx.exit()
@click.group()
@click.option('--version',
is_flag=True,
callback=print_version,
expose_value=False,
is_eager=True)
def main():
args = vars(parse_args()) # dict-like view of namespace
if args.get("file"):
handle_local(args["file"])
elif args.get("frontend"):
handle_frontend(args["frontend"])
pass
for frontend in frontends:
main.add_command(frontend)
if __name__ == "__main__":
if __name__ == '__main__':
main()
import crayons
import logging
import sys
from pathlib import Path
from mubench.models import TaskSet
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def handle_frontend(fe):
pass
def handle_trigger(**kwargs):
pass
def handle_local(p, analyse=False):
if not Path(p).is_file():
logger.critical(
crayons.red("File doesn't exists, path: {}".format(p),
bold=True))
sys.exit(1)
ts = TaskSet.from_file(p)
ts.run()
if analyse:
pass
from .local import local
frontends = [local]
import logging
import click
from mubench.models import TaskSet
logger = logging.getLogger(__name__)
@click.command()
@click.argument('file', type=click.Path(exists=True))
@click.option('--analyse', default=False)
def local(file, analyse):
ts = TaskSet.from_file(file)
ts.run()
if analyse:
pass
......@@ -4,7 +4,6 @@ import subprocess as subproc
from mubench.exceptions import ExecutionFailure
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Language:
......@@ -22,7 +21,7 @@ class Language:
@classmethod
def run_in_subproc(cls, cmd, env=None):
logger.info("Running {} in subproc".format(cmd))
logger.info("Running {}".format(cmd))
res = subproc.run(cmd, stdout=subproc.PIPE, stderr=subproc.PIPE,
env=env)
if res.returncode != 0:
......
......@@ -8,7 +8,6 @@ from mubench.models import Result
from mubench.lang import get_lang
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Task:
......
......@@ -7,7 +7,6 @@ from mubench.exceptions import ExecutionFailure
from mubench.models import Task
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def task_print(task_name, message):
......
PyYAML>=3.12
crayons>=0.1.2
scipy>=0.19.0
numpy>=1.12.1
\ No newline at end of file
numpy>=1.12.1
click>=6.7
\ No newline at end of file
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