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.2% of users enabled 2FA.

Commit 993e7383 authored by Zixian Cai's avatar Zixian Cai
Browse files

Support dumping log to a json file

parent 49b5aed9
......@@ -15,8 +15,9 @@
import logging
import click
import json
from mubench.frontend.utils import go_through_pipelines
from mubench.frontend.utils import go_through_pipelines, platform_info
from mubench.models.revision import LocalRevision
from mubench.models.pipeline import pipelines
......@@ -40,7 +41,12 @@ def local(file, pipeline, skip_compile, dump):
logger.info("Constructing a LocalRevision")
revision = LocalRevision(file)
logger.info("Running tasks specified in file")
revision.run_tasksets(skip_compile)
go_through_pipelines(revision.tasksets, pipeline_names=pipeline.split(","))
if dump:
with open(dump) as logfile:
pass
logger.info("Dumping log to {}".format(dump))
with open(dump, "w") as logfile:
logs = [ts.get_log() for ts in revision.tasksets]
for x in logs:
x.update(platform_info())
json.dump(logs, logfile)
......@@ -15,6 +15,7 @@
import logging
from mubench.models.pipeline import pipelines
from mubench.util import get_cpu_model, get_hostname, get_uname
logger = logging.getLogger(__name__)
......@@ -23,3 +24,11 @@ def go_through_pipelines(report, pipeline_names):
ps = [pipelines[name]() for name in pipeline_names]
for pipeline in ps:
report = pipeline.process(report)
def platform_info():
return {
"cpu": get_cpu_model(),
"uname": get_uname(),
"hostname": get_hostname()
}
......@@ -90,13 +90,13 @@ def get_cpu_model():
return models[0].split("\t")[1][2:]
elif platform.system() == "Darwin":
cmd = "sysctl -n machdep.cpu.brand_string"
return subprocess.check_output(cmd.split())
return subprocess.check_output(cmd.split()).decode("utf-8").strip()
else:
return "Not supported"
def get_uname():
return subprocess.check_output(["uname", "-a"])
return subprocess.check_output(["uname", "-a"]).decode("utf-8").strip()
def get_hostname():
......
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