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):"Constructing LocalProject. File: {}".format(file))
p = LocalProject(file=file)"Constructing a fake Revision")
revision = Revision(p)"Constructing a LocalRevision")
revision = LocalRevision(file)"Running tasks specified in file")
revision.run_taskset()"Generating report, compare?: {}".format(compare))
report = revision.generate_report(compare=compare)"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):
class GitLabProject(BaseProject):
class GitLabProject(Project):
def download_revision(self):
class LocalProject(BaseProject):
def __init__(self, **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
self.results = {task: task.get_result() for task in ts.tasks}
......@@ -38,3 +39,11 @@ class Revision:
class LocalRevision(Revision):
def __init__(self, file, **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