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

local.py 2.15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/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.

16 17
import logging
import click
18
import json
19

20
from mubench.frontend.utils import go_through_pipelines, platform_info
Zixian Cai's avatar
Zixian Cai committed
21
from mubench.models.revision import LocalRevision
22
from mubench.models.pipeline import pipelines
23 24 25 26 27 28

logger = logging.getLogger(__name__)


@click.command()
@click.argument('file', type=click.Path(exists=True))
29 30 31 32
@click.option("--pipeline", default="box,bar",
              help="Combination of [{}], separated by comma".format(
                  ",".join(pipelines.keys())
              ))
33 34 35 36 37
@click.option('--skip_compile', default='none',
              help="a list of tasks to skip compilation." +
                   "Can be 'all', 'none', or a string in the form of 'taskset1:task1,task2;taskset2'. " +
                   "If only a task set's name is defined, skip compilation of all its tasks. " +
                   "Default target in the form of 'taskset-task' is assumed to be found under output directory.")
Zixian Cai's avatar
Zixian Cai committed
38 39 40
@click.option("--dump", default=None,
              help="Dump log file to path")
def local(file, pipeline, skip_compile, dump):
41 42
    logger.info("Constructing a LocalRevision")
    revision = LocalRevision(file)
Zixian Cai's avatar
Zixian Cai committed
43
    logger.info("Running tasks specified in file")
44
    revision.run_tasksets(skip_compile)
45
    go_through_pipelines(revision.tasksets, pipeline_names=pipeline.split(","))
Zixian Cai's avatar
Zixian Cai committed
46
    if dump:
47 48 49 50 51 52
        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)