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 a98e4276 authored by Zixian Cai's avatar Zixian Cai
Browse files

Associate taskset with Revision not Project

parent 330efb76
import logging
import click
from mubench.models import LocalProject, Revision
from mubench.models import LocalRevision
logger = logging.getLogger(__name__)
......@@ -10,12 +10,10 @@ logger = logging.getLogger(__name__)
@click.argument('file', type=click.Path(exists=True))
@click.option('--compare', is_flag=True, default=False)
def local(file, compare):
logger.info("Constructing LocalProject. File: {}".format(file))
p = LocalProject(file=file)
logger.info("Constructing a fake Revision")
revision = Revision(p)
logger.info("Constructing a LocalRevision")
revision = LocalRevision(file)
logger.info("Running tasks specified in file")
revision.run_tasks()
revision.run_taskset()
logger.info("Generating report, compare?: {}".format(compare))
report = revision.generate_report(compare=compare)
logger.info("Printing report")
......
from .project import BaseProject, GitLabProject, LocalProject
from .project import Project, GitLabProject
from .report import Report
from .result import Result
from .revision import Revision
from .revision import Revision, LocalRevision
from .task import Task
from .taskset import TaskSet
class BaseProject:
class Project:
"""
A project corresponds to a repository (Git, Mercurial, etc.)
It has a set of tasks (ad-hoc or predefined).
......@@ -10,19 +10,7 @@ class BaseProject:
for k in kwargs:
setattr(self, k, kwargs[k])
def task_set(self):
pass
class GitLabProject(BaseProject):
class GitLabProject(Project):
def download_revision(self):
pass
class LocalProject(BaseProject):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def task_set(self):
from mubench.models import TaskSet
return TaskSet.from_file(self.file)
......@@ -7,14 +7,15 @@ class Revision:
It has a hash string, time of creation, and other metadata (branch, etc.).
"""
def __init__(self, proj):
self.proj = proj
def __init__(self, **kwargs):
for k in kwargs:
setattr(self, k, kwargs[k])
def run_tasks(self):
def run_taskset(self):
"""
Run tasks and store the result as attribute
"""
ts = self.proj.task_set()
ts = self.taskset
ts.run()
self.results = {task: task.get_result() for task in ts.tasks}
......@@ -38,3 +39,11 @@ class Revision:
:return:
"""
pass
class LocalRevision(Revision):
def __init__(self, file, **kwargs):
super().__init__(**kwargs)
self.file = file
from mubench.models import TaskSet
self.taskset = TaskSet.from_file(self.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