示例#1
0
def v4_daily_report_overview():
    # Redirect to the report for the most recent submitted run's date.

    ts = request.get_testsuite()

    # Get the latest run.
    latest = ts.query(ts.Run).\
        order_by(ts.Run.start_time.desc()).limit(1).first()

    # If we found a run, use it's start time.
    if latest:
        date = latest.start_time
    else:
        # Otherwise, just use today.
        date = datetime.date.today()

    extra_args = request.args.copy()
    extra_args.pop("year", None)
    extra_args.pop("month", None)
    extra_args.pop("day", None)

    return redirect(
        v4_url_for("v4_daily_report",
                   year=date.year,
                   month=date.month,
                   day=date.day,
                   **extra_args))
示例#2
0
def v4_profile_ajax_getTopLevelCounters():
    session = request.session
    ts = request.get_testsuite()
    runids = request.args.get('runids').split(',')
    testid = request.args.get('testid')

    profileDir = current_app.old_config.profileDir

    idx = 0
    tlc = {}
    for rid in runids:
        sample = session.query(ts.Sample) \
                   .filter(ts.Sample.run_id == rid) \
                   .filter(ts.Sample.test_id == testid).first()
        if sample and sample.profile:
            p = sample.profile.load(profileDir)
            for k, v in p.getTopLevelCounters().items():
                tlc.setdefault(k, [None]*len(runids))[idx] = v
        idx += 1

    # If the 1'th counter is None for all keys, truncate the list.
    if all(len(k) > 1 and k[1] is None for k in tlc.values()):
        tlc = {k: [v[0]] for k, v in tlc.items()}

    return json.dumps(tlc)
示例#3
0
文件: api.py 项目: couchbaselabs/cbnt
    def get(self, machine_id, test_id, field_index):
        """Get the data for a particular line in a graph."""
        ts = request.get_testsuite()
        # Maybe we don't need to do this?
        try:
            machine = ts.query(ts.Machine) \
                .filter(ts.Machine.id == machine_id) \
                .one()
            test = ts.query(ts.Test) \
                .filter(ts.Test.id == test_id) \
                .one()
            field = ts.sample_fields[field_index]
        except NoResultFound:
            return abort(404)

        q = ts.query(field.column, ts.Order.llvm_project_revision, ts.Run.start_time, ts.Run.id) \
            .join(ts.Run) \
            .join(ts.Order) \
            .filter(ts.Run.machine_id == machine.id) \
            .filter(ts.Sample.test == test) \
            .filter(field.column != None) \
            .order_by(ts.Order.llvm_project_revision)

        if field.status_field:
            q = q.filter((field.status_field.column == PASS) |
                         (field.status_field.column == None))
        samples = [[rev, val, {'label': rev, 'date': str(time), 'runID': str(rid)}] for val, rev, time, rid in q.all()]

        return samples
示例#4
0
    def get(run_id):
        session = request.session
        ts = request.get_testsuite()
        try:
            run = session.query(ts.Run) \
                .filter(ts.Run.id == run_id) \
                .options(joinedload(ts.Run.machine)) \
                .options(joinedload(ts.Run.order)) \
                .one()
        except sqlalchemy.orm.exc.NoResultFound:
            abort(404, msg="Did not find run " + str(run_id))

        to_get = [ts.Sample.id, ts.Sample.run_id, ts.Test.name]
        for f in ts.sample_fields:
            to_get.append(f.column)

        sample_query = session.query(*to_get) \
            .join(ts.Test) \
            .filter(ts.Sample.run_id == run_id) \
            .all()
        # TODO: Handle multiple samples for a single test?

        # noinspection PyProtectedMember
        samples = [row._asdict() for row in sample_query]

        result = common_fields_factory()
        result['run'] = run
        result['machine'] = run.machine
        result['tests'] = samples
        return result
示例#5
0
文件: api.py 项目: llvm-mirror/lnt
    def get():
        """Get the data for a particular line in a graph."""
        session = request.session
        ts = request.get_testsuite()
        args = request.args.to_dict(flat=False)
        # Maybe we don't need to do this?
        run_ids = [int(r) for r in args.get('runid', [])]

        if not run_ids:
            abort(400, msg='No runids found in args. '
                           'Should be "samples?runid=1&runid=2" etc.')

        to_get = [ts.Sample.id,
                  ts.Sample.run_id,
                  ts.Test.name,
                  ts.Order.fields[0].column]

        for f in ts.sample_fields:
            to_get.append(f.column)

        q = session.query(*to_get) \
            .join(ts.Test) \
            .join(ts.Run) \
            .join(ts.Order) \
            .filter(ts.Sample.run_id.in_(run_ids))
        result = common_fields_factory()
        # noinspection PyProtectedMember
        result['samples'] = [{k: v for k, v in sample.items() if v is not None}
                             for sample in [sample._asdict()
                                            for sample in q.all()]]

        return result
示例#6
0
文件: api.py 项目: BillSeurer/lnt
 def get(self, order_id):
     ts = request.get_testsuite()
     try:
         changes = ts.query(ts.Order).filter(ts.Order.id == order_id).one()
     except NoResultFound:
         abort(404, message="Invalid order.")
     return changes
示例#7
0
 def get(self, order_id):
     ts = request.get_testsuite()
     try:
         changes = ts.query(ts.Order).filter(ts.Order.id == order_id).one()
     except NoResultFound:
         abort(404, message="Invalid order.")
     return changes
示例#8
0
文件: views.py 项目: BillSeurer/lnt
def v4_daily_report(year, month, day):
    num_days_str = request.args.get('num_days')
    if num_days_str is not None:
        num_days = int(num_days_str)
    else:
        num_days = 3

    day_start_str = request.args.get('day_start')
    if day_start_str is not None:
        day_start = int(day_start_str)
    else:
        day_start = 16

    filter_machine_regex = request.args.get('filter-machine-regex')

    ts = request.get_testsuite()

    # Create the report object.
    report = lnt.server.reporting.dailyreport.DailyReport(
        ts, year, month, day, num_days, day_start,
        filter_machine_regex=filter_machine_regex)

    # Build the report.
    try:
        report.build()
    except ValueError:
        return abort(400)

    return render_template("v4_daily_report.html", ts=ts, report=report,
                           analysis=lnt.server.reporting.analysis)
示例#9
0
文件: api.py 项目: llvm-mirror/lnt
    def get(run_id):
        session = request.session
        ts = request.get_testsuite()
        try:
            run = session.query(ts.Run) \
                .filter(ts.Run.id == run_id) \
                .options(joinedload(ts.Run.machine)) \
                .options(joinedload(ts.Run.order)) \
                .one()
        except sqlalchemy.orm.exc.NoResultFound:
            abort(404, msg="Did not find run " + str(run_id))

        to_get = [ts.Sample.id, ts.Sample.run_id, ts.Test.name]
        for f in ts.sample_fields:
            to_get.append(f.column)

        sample_query = session.query(*to_get) \
            .join(ts.Test) \
            .filter(ts.Sample.run_id == run_id) \
            .all()
        # TODO: Handle multiple samples for a single test?

        # noinspection PyProtectedMember
        samples = [row._asdict() for row in sample_query]

        result = common_fields_factory()
        result['run'] = run
        result['machine'] = run.machine
        result['tests'] = samples
        return result
示例#10
0
    def get(self, machine_id, test_id, field_index):
        """Get the data for a particular line in a graph."""
        ts = request.get_testsuite()
        # Maybe we don't need to do this?
        try:
            machine = ts.query(ts.Machine) \
                .filter(ts.Machine.id == machine_id) \
                .one()
            test = ts.query(ts.Test) \
                .filter(ts.Test.id == test_id) \
                .one()
            field = ts.sample_fields[field_index]
        except NoResultFound:
            return abort(404)

        q = ts.query(field.column, ts.Order.llvm_project_revision, ts.Run.start_time, ts.Run.id) \
            .join(ts.Run) \
            .join(ts.Order) \
            .filter(ts.Run.machine_id == machine.id) \
            .filter(ts.Sample.test == test) \
            .filter(field.column != None) \
            .order_by(ts.Order.llvm_project_revision)

        if field.status_field:
            q = q.filter((field.status_field.column == PASS)
                         | (field.status_field.column == None))
        samples = [[
            rev, val, {
                'label': rev,
                'date': str(time),
                'runID': str(rid)
            }
        ] for val, rev, time, rid in q.all()]

        return samples
示例#11
0
文件: views.py 项目: BillSeurer/lnt
def v4_machine(id):
    # Compute the list of associated runs, grouped by order.
    from lnt.server.ui import util

    # Gather all the runs on this machine.
    ts = request.get_testsuite()

    associated_runs = util.multidict(
        (run_order, r)
        for r,run_order in ts.query(ts.Run, ts.Order).\
            join(ts.Order).\
            filter(ts.Run.machine_id == id).\
            order_by(ts.Run.start_time.desc()))
    associated_runs = associated_runs.items()
    associated_runs.sort()

    if request.args.get('json'):
        json_obj = dict()
        machine_obj = ts.query(ts.Machine).filter(ts.Machine.id == id).one()
        json_obj['name'] = machine_obj.name
        json_obj['id'] = machine_obj.id
        json_obj['runs'] = []
        for order in associated_runs:
            rev = order[0].llvm_project_revision
            for run in order[1]:
                json_obj['runs'].append((run.id, rev,
                                         run.start_time.isoformat(), run.end_time.isoformat()))
        return flask.jsonify(**json_obj)
    try:
        return render_template("v4_machine.html",
                           testsuite_name=g.testsuite_name, id=id,
                           associated_runs=associated_runs)
    except NoResultFound as e:
        abort(404)
示例#12
0
def v4_run_graph(id):
    # This is an old style endpoint that treated graphs as associated with
    # runs. Redirect to the new endpoint.

    ts = request.get_testsuite()
    run = ts.query(ts.Run).filter_by(id=id).first()
    if run is None:
        abort(404)

    # Convert the old style test parameters encoding.
    args = {'highlight_run': id}
    plot_number = 0
    for name, value in request.args.items():
        # If this isn't a test specification, just forward it.
        if not name.startswith('test.'):
            args[name] = value
            continue

        # Otherwise, rewrite from the old style of::
        #
        #   test.<test id>=<sample field index>
        #
        # into the new style of::
        #
        #   plot.<number>=<machine id>.<test id>.<sample field index>
        test_id = name.split('.', 1)[1]
        args['plot.%d' %
             (plot_number, )] = '%d.%s.%s' % (run.machine.id, test_id, value)
        plot_number += 1

    return redirect(v4_url_for("v4_graph", **args))
示例#13
0
文件: views.py 项目: BillSeurer/lnt
def v4_run_graph(id):
    # This is an old style endpoint that treated graphs as associated with
    # runs. Redirect to the new endpoint.

    ts = request.get_testsuite()
    run = ts.query(ts.Run).filter_by(id=id).first()
    if run is None:
        abort(404)

    # Convert the old style test parameters encoding.
    args = { 'highlight_run' : id }
    plot_number = 0
    for name,value in request.args.items():
        # If this isn't a test specification, just forward it.
        if not name.startswith('test.'):
            args[name] = value
            continue

        # Otherwise, rewrite from the old style of::
        #
        #   test.<test id>=<sample field index>
        #
        # into the new style of::
        #
        #   plot.<number>=<machine id>.<test id>.<sample field index>
        test_id = name.split('.', 1)[1]
        args['plot.%d' % (plot_number,)] = '%d.%s.%s' % (
            run.machine.id, test_id, value)
        plot_number += 1

    return redirect(v4_url_for("v4_graph", **args))
示例#14
0
    def get():
        """Get the data for a particular line in a graph."""
        session = request.session
        ts = request.get_testsuite()
        args = request.args.to_dict(flat=False)
        # Maybe we don't need to do this?
        run_ids = [int(r) for r in args.get('runid', [])]

        if not run_ids:
            abort(400,
                  msg='No runids found in args. '
                  'Should be "samples?runid=1&runid=2" etc.')

        to_get = [
            ts.Sample.id, ts.Sample.run_id, ts.Test.name,
            ts.Order.fields[0].column
        ]

        for f in ts.sample_fields:
            to_get.append(f.column)

        q = session.query(*to_get) \
            .join(ts.Test) \
            .join(ts.Run) \
            .join(ts.Order) \
            .filter(ts.Sample.run_id.in_(run_ids))
        result = common_fields_factory()
        # noinspection PyProtectedMember
        result['samples'] = [{
            k: v
            for k, v in sample.items() if v is not None
        } for sample in [sample._asdict() for sample in q.all()]]

        return result
示例#15
0
    def get():
        ts = request.get_testsuite()
        session = request.session
        machines = session.query(ts.Machine).all()

        result = common_fields_factory()
        result['machines'] = machines
        return result
示例#16
0
文件: api.py 项目: TUBOSS/lnt
    def get():
        ts = request.get_testsuite()

        result = common_fields_factory()
        tests = request.session.query(ts.Test).all()
        result['tests'] = [t.__json__() for t in tests]

        return result
示例#17
0
    def get():
        ts = request.get_testsuite()

        result = common_fields_factory()
        result['fields'] = [{'column_id': i, 'column_name': f.column.name}
                            for i, f in enumerate(ts.sample_fields)]

        return result
示例#18
0
文件: api.py 项目: llvm-mirror/lnt
    def get():
        ts = request.get_testsuite()
        session = request.session
        machines = session.query(ts.Machine).all()

        result = common_fields_factory()
        result['machines'] = machines
        return result
示例#19
0
def v4_machines():
    # Compute the list of associated runs, grouped by order.
    from lnt.server.ui import util

    # Gather all the runs on this machine.
    ts = request.get_testsuite()

    return render_template("all_machines.html", ts=ts)
示例#20
0
文件: api.py 项目: llvm-mirror/lnt
    def get():
        ts = request.get_testsuite()

        result = common_fields_factory()
        tests = request.session.query(ts.Test).all()
        result['tests'] = [t.__json__() for t in tests]

        return result
示例#21
0
文件: api.py 项目: llvm-mirror/lnt
    def get():
        ts = request.get_testsuite()

        result = common_fields_factory()
        result['fields'] = [{'column_id': i, 'column_name': f.column.name}
                            for i, f in enumerate(ts.sample_fields)]

        return result
示例#22
0
def v4_new_regressions():
    form = TriagePageSelectedForm(request.form)
    session = request.session
    ts = request.get_testsuite()
    if request.method == 'POST' and \
            request.form['btn'] == "Create New Regression":
        regression, _ = new_regression(session, ts, form.field_changes.data)
        flash("Created " + regression.title, FLASH_SUCCESS)
        return redirect(
            v4_url_for(".v4_regression_list", highlight=regression.id))
    if request.method == 'POST' and request.form['btn'] == "Ignore Changes":
        msg = "Ignoring changes: "
        ignored = []
        for fc_id in form.field_changes.data:
            ignored.append(str(fc_id))
            fc = get_fieldchange(session, ts, fc_id)
            ignored_change = ts.ChangeIgnore(fc)
            session.add(ignored_change)
        session.commit()
        flash(msg + ", ".join(ignored), FLASH_SUCCESS)


#    d = datetime.datetime.now()
#    two_weeks_ago = d - datetime.timedelta(days=14)
    recent_fieldchange = session.query(ts.FieldChange) \
        .join(ts.Test) \
        .outerjoin(ts.ChangeIgnore) \
        .filter(ts.ChangeIgnore.id.is_(None)) \
        .outerjoin(ts.RegressionIndicator) \
        .filter(ts.RegressionIndicator.id.is_(None)) \
        .order_by(desc(ts.FieldChange.id)) \
        .limit(500) \
        .all()
    crs = []

    form.field_changes.choices = list()
    for fc in recent_fieldchange:
        if fc.old_value is None:
            cr, key_run, _ = get_cr_for_field_change(session, ts, fc)
        else:
            cr = PrecomputedCR(fc.old_value, fc.new_value,
                               fc.field.bigger_is_better)
            key_run = get_first_runs_of_fieldchange(session, ts, fc)
        current_cr, _, _ = get_cr_for_field_change(session,
                                                   ts,
                                                   fc,
                                                   current=True)
        crs.append(ChangeData(fc, cr, key_run, current_cr))
        form.field_changes.choices.append((
            fc.id,
            1,
        ))
    return render_template("v4_new_regressions.html",
                           testsuite_name=g.testsuite_name,
                           changes=crs,
                           analysis=lnt.server.reporting.analysis,
                           form=form,
                           **ts_data(ts))
示例#23
0
文件: api.py 项目: llvm-mirror/lnt
 def put(machine_spec):
     machine = Machine._get_machine(machine_spec)
     machine_name = "%s:%s" % (machine.name, machine.id)
     data = json.loads(request.data)
     machine_data = data['machine']
     machine.set_from_dict(machine_data)
     session = request.session
     ts = request.get_testsuite()
     session.commit()
示例#24
0
文件: api.py 项目: llvm-mirror/lnt
 def delete(run_id):
     session = request.session
     ts = request.get_testsuite()
     run = session.query(ts.Run).filter(ts.Run.id == run_id).first()
     if run is None:
         abort(404, msg="Did not find run " + str(run_id))
     session.delete(run)
     session.commit()
     logger.info("Deleted run %s" % (run_id,))
示例#25
0
文件: api.py 项目: BillSeurer/lnt
    def get(self, run_id):
        ts = request.get_testsuite()
        try:
            changes = ts.query(ts.Run).join(ts.Machine).filter(ts.Run.id == run_id).one()
        except NoResultFound:
            abort(404, message="Invalid run.")

        changes = with_ts(changes)
        return changes
示例#26
0
 def delete(run_id):
     session = request.session
     ts = request.get_testsuite()
     run = session.query(ts.Run).filter(ts.Run.id == run_id).first()
     if run is None:
         abort(404, msg="Did not find run " + str(run_id))
     session.delete(run)
     session.commit()
     logger.info("Deleted run %s" % (run_id, ))
示例#27
0
文件: views.py 项目: BillSeurer/lnt
def v4_machines():
    # Compute the list of associated runs, grouped by order.
    from lnt.server.ui import util

    # Gather all the runs on this machine.
    ts = request.get_testsuite()

    return render_template("all_machines.html",
                       ts=ts)
示例#28
0
 def put(machine_spec):
     machine = Machine._get_machine(machine_spec)
     machine_name = "%s:%s" % (machine.name, machine.id)
     data = json.loads(request.data)
     machine_data = data['machine']
     machine.set_from_dict(machine_data)
     session = request.session
     ts = request.get_testsuite()
     session.commit()
示例#29
0
    def get(self, run_id):
        ts = request.get_testsuite()
        try:
            changes = ts.query(ts.Run).join(
                ts.Machine).filter(ts.Run.id == run_id).one()
        except NoResultFound:
            abort(404, message="Invalid run.")

        changes = with_ts(changes)
        return changes
示例#30
0
文件: views.py 项目: BillSeurer/lnt
def v4_order(id):
    # Get the testsuite.
    ts = request.get_testsuite()

    # Get the order.
    order = ts.query(ts.Order).filter(ts.Order.id == id).first()
    if order is None:
        abort(404)

    return render_template("v4_order.html", ts=ts, order=order)
示例#31
0
def v4_order(id):
    # Get the testsuite.
    ts = request.get_testsuite()

    # Get the order.
    order = ts.query(ts.Order).filter(ts.Order.id == id).first()
    if order is None:
        abort(404)

    return render_template("v4_order.html", ts=ts, order=order)
示例#32
0
文件: api.py 项目: llvm-mirror/lnt
 def get(order_id):
     session = request.session
     ts = request.get_testsuite()
     try:
         order = session.query(ts.Order) \
             .filter(ts.Order.id == order_id).one()
     except NoResultFound:
         abort(404, message="Invalid order.")
     result = common_fields_factory()
     result['orders'] = [order]
     return result
示例#33
0
文件: views.py 项目: BillSeurer/lnt
def v4_all_orders():
    # Get the testsuite.
    ts = request.get_testsuite()

    # Get the orders.
    orders = ts.query(ts.Order).all()

    # Order the runs totally.
    orders.sort()

    return render_template("v4_all_orders.html", ts=ts, orders=orders)
示例#34
0
def v4_all_orders():
    # Get the testsuite.
    ts = request.get_testsuite()

    # Get the orders.
    orders = ts.query(ts.Order).all()

    # Order the runs totally.
    orders.sort()

    return render_template("v4_all_orders.html", ts=ts, orders=orders)
示例#35
0
 def get(order_id):
     session = request.session
     ts = request.get_testsuite()
     try:
         order = session.query(ts.Order) \
             .filter(ts.Order.id == order_id).one()
     except NoResultFound:
         abort(404, message="Invalid order.")
     result = common_fields_factory()
     result['orders'] = [order]
     return result
示例#36
0
def v4_regression_list():

    ts = request.get_testsuite()
    form = MergeRegressionForm(request.form)

    if request.method == 'POST' and \
       request.form['merge_btn'] == "Merge Regressions":
        regressions_id_to_merge = form.regression_checkboxes.data
        regressions = ts.query(ts.Regression) \
            .filter(ts.Regression.id.in_(regressions_id_to_merge)).all()
        reg_inds = ts.query(ts.RegressionIndicator) \
            .filter(ts.RegressionIndicator.regression_id.in_(
                    regressions_id_to_merge)) \
            .all()
        new_regress = new_regression(ts, [x.field_change_id for x in reg_inds])
        new_regress.state = regressions[0].state
        [ts.delete(x) for x in reg_inds]
        [ts.delete(x) for x in regressions]
        ts.commit()
        flash("Created" + new_regress.title, FLASH_SUCCESS)
        return redirect(v4_url_for("v4_regression_detail", id=new_regress.id))

    state_filter = int(request.args.get('state', RegressionState.ACTIVE))
    q = ts.query(ts.Regression)
    title = "All Regressions"
    if state_filter != -1:
        q = q.filter(ts.Regression.state == state_filter)
        title = RegressionState.names[state_filter]
    regression_info = q.all()[::-1]

    form.regression_checkboxes.choices = list()
    regression_sizes = []
    impacts = []
    for regression in regression_info:
        form.regression_checkboxes.choices.append((
            regression.id,
            1,
        ))
        reg_inds = ts.query(ts.RegressionIndicator) \
            .filter(ts.RegressionIndicator.regression_id ==
                    regression.id) \
            .all()
        regression_sizes.append(len(reg_inds))
        impacts.append(calc_impact(ts, [x.field_change for x in reg_inds]))
    return render_template("v4_regression_list.html",
                           testsuite_name=g.testsuite_name,
                           regressions=regression_info,
                           highlight=request.args.get('highlight'),
                           title=title,
                           RegressionState=RegressionState,
                           form=form,
                           sizes=regression_sizes,
                           impacts=impacts,
                           analysis=lnt.server.reporting.analysis)
示例#37
0
文件: api.py 项目: llvm-mirror/lnt
 def get(sample_id):
     session = request.session
     ts = request.get_testsuite()
     try:
         sample = session.query(ts.Sample) \
             .filter(ts.Sample.id == sample_id) \
             .one()
     except NoResultFound:
         abort(404, message="Invalid order.")
     result = common_fields_factory()
     result['samples'] = [sample]
     return result
示例#38
0
 def get(sample_id):
     session = request.session
     ts = request.get_testsuite()
     try:
         sample = session.query(ts.Sample) \
             .filter(ts.Sample.id == sample_id) \
             .one()
     except NoResultFound:
         abort(404, message="Invalid order.")
     result = common_fields_factory()
     result['samples'] = [sample]
     return result
示例#39
0
def v4_regression_list():

    ts = request.get_testsuite()
    form = MergeRegressionForm(request.form)

    if request.method == 'POST' and \
       request.form['merge_btn'] == "Merge Regressions":
        regressions_id_to_merge = form.regression_checkboxes.data
        regressions = ts.query(ts.Regression) \
            .filter(ts.Regression.id.in_(regressions_id_to_merge)).all()
        reg_inds = ts.query(ts.RegressionIndicator) \
            .filter(ts.RegressionIndicator.regression_id.in_(
                    regressions_id_to_merge)) \
            .all()
        new_regress = new_regression(ts, [x.field_change_id for x in reg_inds])
        new_regress.state = regressions[0].state
        [ts.delete(x) for x in reg_inds]
        [ts.delete(x) for x in regressions]
        ts.commit()
        flash("Created" + new_regress.title, FLASH_SUCCESS)
        return redirect(v4_url_for("v4_regression_detail", id=new_regress.id))

    state_filter = int(request.args.get('state', RegressionState.ACTIVE))
    q = ts.query(ts.Regression)
    title = "All Regressions"
    if state_filter != -1:
        q = q.filter(ts.Regression.state == state_filter)
        title = RegressionState.names[state_filter]
    regression_info = q.all()[::-1]

    form.regression_checkboxes.choices = list()
    regression_sizes = []
    impacts = []
    for regression in regression_info:
        form.regression_checkboxes.choices.append((regression.id, 1,))
        reg_inds = ts.query(ts.RegressionIndicator) \
            .filter(ts.RegressionIndicator.regression_id ==
                    regression.id) \
            .all()
        regression_sizes.append(len(reg_inds))
        impacts.append(calc_impact(ts, [x.field_change for x in reg_inds]))
    return render_template("v4_regression_list.html",
                           testsuite_name=g.testsuite_name,
                           regressions=regression_info,
                           highlight=request.args.get('highlight'),
                           title=title,
                           RegressionState=RegressionState,
                           form=form,
                           sizes=regression_sizes,
                           impacts=impacts,
                           analysis=lnt.server.reporting.analysis)
示例#40
0
def v4_new_regressions():
    form = TriagePageSelectedForm(request.form)
    session = request.session
    ts = request.get_testsuite()
    if request.method == 'POST' and \
            request.form['btn'] == "Create New Regression":
        regression, _ = new_regression(session, ts, form.field_changes.data)
        flash("Created " + regression.title, FLASH_SUCCESS)
        return redirect(v4_url_for(".v4_regression_list",
                        highlight=regression.id))
    if request.method == 'POST' and request.form['btn'] == "Ignore Changes":
        msg = "Ignoring changes: "
        ignored = []
        for fc_id in form.field_changes.data:
            ignored.append(str(fc_id))
            fc = get_fieldchange(session, ts, fc_id)
            ignored_change = ts.ChangeIgnore(fc)
            session.add(ignored_change)
        session.commit()
        flash(msg + ", ".join(ignored), FLASH_SUCCESS)

#    d = datetime.datetime.now()
#    two_weeks_ago = d - datetime.timedelta(days=14)
    recent_fieldchange = session.query(ts.FieldChange) \
        .join(ts.Test) \
        .outerjoin(ts.ChangeIgnore) \
        .filter(ts.ChangeIgnore.id.is_(None)) \
        .outerjoin(ts.RegressionIndicator) \
        .filter(ts.RegressionIndicator.id.is_(None)) \
        .order_by(desc(ts.FieldChange.id)) \
        .limit(500) \
        .all()
    crs = []

    form.field_changes.choices = list()
    for fc in recent_fieldchange:
        if fc.old_value is None:
            cr, key_run, _ = get_cr_for_field_change(session, ts, fc)
        else:
            cr = PrecomputedCR(fc.old_value, fc.new_value,
                               fc.field.bigger_is_better)
            key_run = get_first_runs_of_fieldchange(session, ts, fc)
        current_cr, _, _ = get_cr_for_field_change(session, ts, fc,
                                                   current=True)
        crs.append(ChangeData(fc, cr, key_run, current_cr))
        form.field_changes.choices.append((fc.id, 1,))
    return render_template("v4_new_regressions.html",
                           testsuite_name=g.testsuite_name,
                           changes=crs, analysis=lnt.server.reporting.analysis,
                           form=form, **ts_data(ts))
示例#41
0
文件: api.py 项目: BillSeurer/lnt
    def get(self, machine_id):

        ts = request.get_testsuite()
        try:
            machine = ts.query(ts.Machine).filter(ts.Machine.id == machine_id).one()
        except NoResultFound:
            abort(404, message="Invalid machine.")

        machine = with_ts(machine)
        machine_runs = ts.query(ts.Run.id).join(ts.Machine).filter(ts.Machine.id == machine_id).all()

        machine["runs"] = with_ts([dict(run_id=x[0]) for x in machine_runs])
        print machine["runs"]
        return machine
示例#42
0
    def get(machine_spec):
        ts = request.get_testsuite()
        session = request.session
        machine = Machine._get_machine(machine_spec)
        machine_runs = session.query(ts.Run) \
            .filter(ts.Run.machine_id == machine.id) \
            .options(joinedload(ts.Run.order)) \
            .all()

        runs = [run.__json__(flatten_order=True) for run in machine_runs]

        result = common_fields_factory()
        result['machine'] = machine
        result['runs'] = runs
        return result
示例#43
0
def v4_profile_ajax_getCodeForFunction():
    session = request.session
    ts = request.get_testsuite()
    runid = request.args.get('runid')
    testid = request.args.get('testid')
    f = request.args.get('f')

    profileDir = current_app.old_config.profileDir

    sample = _get_sample(session, ts, runid, testid)
    if not sample or not sample.profile:
        abort(404)

    p = sample.profile.load(profileDir)
    return json.dumps([x for x in p.getCodeForFunction(f)])
示例#44
0
文件: api.py 项目: llvm-mirror/lnt
    def get(machine_spec):
        ts = request.get_testsuite()
        session = request.session
        machine = Machine._get_machine(machine_spec)
        machine_runs = session.query(ts.Run) \
            .filter(ts.Run.machine_id == machine.id) \
            .options(joinedload(ts.Run.order)) \
            .all()

        runs = [run.__json__(flatten_order=True) for run in machine_runs]

        result = common_fields_factory()
        result['machine'] = machine
        result['runs'] = runs
        return result
示例#45
0
def v4_profile_ajax_getCodeForFunction():
    ts = request.get_testsuite()
    runid = request.args.get('runid')
    testid = request.args.get('testid')
    f = request.args.get('f')

    profileDir = current_app.old_config.profileDir

    sample = ts.query(ts.Sample) \
               .filter(ts.Sample.run_id == runid) \
               .filter(ts.Sample.test_id == testid).first()
    if not sample or not sample.profile:
        abort(404)

    p = sample.profile.load(profileDir)
    return json.dumps([x for x in p.getCodeForFunction(f)])
示例#46
0
    def get(self, machine_id):

        ts = request.get_testsuite()
        try:
            machine = ts.query(
                ts.Machine).filter(ts.Machine.id == machine_id).one()
        except NoResultFound:
            abort(404, message="Invalid machine.")

        machine = with_ts(machine)
        machine_runs = ts.query(ts.Run.id).join(
            ts.Machine).filter(ts.Machine.id == machine_id).all()

        machine['runs'] = with_ts([dict(run_id=x[0]) for x in machine_runs])
        print machine['runs']
        return machine
示例#47
0
def v4_profile_ajax_getCodeForFunction():
    ts = request.get_testsuite()
    runid = request.args.get('runid')
    testid = request.args.get('testid')
    f = request.args.get('f')

    profileDir = current_app.old_config.profileDir

    sample = ts.query(ts.Sample) \
               .filter(ts.Sample.run_id == runid) \
               .filter(ts.Sample.test_id == testid).first()
    if not sample or not sample.profile:
        abort(404);

    p = sample.profile.load(profileDir)
    return json.dumps([x for x in p.getCodeForFunction(f)])
示例#48
0
 def get(machine_id, test_id, field_index):
     """Get the regressions for a particular line in a graph."""
     session = request.session
     ts = request.get_testsuite()
     field = ts.sample_fields[field_index]
     # Maybe we don't need to do this?
     fcs = session.query(ts.FieldChange) \
         .filter(ts.FieldChange.machine_id == machine_id) \
         .filter(ts.FieldChange.test_id == test_id) \
         .filter(ts.FieldChange.field_id == field.id) \
         .all()
     fc_ids = [x.id for x in fcs]
     fc_mappings = dict(
         [(x.id, (x.end_order.as_ordered_string(), x.new_value))
          for x in fcs])
     if len(fcs) == 0:
         # If we don't find anything, lets see if we are even looking
         # for a valid thing to provide a nice error.
         try:
             session.query(ts.Machine) \
                 .filter(ts.Machine.id == machine_id) \
                 .one()
             session.query(ts.Test) \
                 .filter(ts.Test.id == test_id) \
                 .one()
             _ = ts.sample_fields[field_index]
         except (NoResultFound, IndexError):
             abort(404)
         # I think we found nothing.
         return []
     regressions = session.query(ts.Regression.title, ts.Regression.id,
                                 ts.RegressionIndicator.field_change_id,
                                 ts.Regression.state) \
         .join(ts.RegressionIndicator) \
         .filter(ts.RegressionIndicator.field_change_id.in_(fc_ids)) \
         .all()
     results = [
         {
             'title': r.title,
             'id': r.id,
             'state': r.state,
             'end_point': fc_mappings[r.field_change_id]
         }
         for r in regressions
     ]
     return results
示例#49
0
def v4_profile_ajax_getFunctions():
    session = request.session
    ts = request.get_testsuite()
    runid = request.args.get('runid')
    testid = request.args.get('testid')

    profileDir = current_app.old_config.profileDir

    idx = 0
    tlc = {}
    sample = _get_sample(session, ts, runid, testid)

    if sample and sample.profile:
        p = sample.profile.load(profileDir)
        return json.dumps([[n, f] for n, f in p.getFunctions().items()])
    else:
        abort(404)
示例#50
0
def v4_profile_ajax_getFunctions():
    ts = request.get_testsuite()
    runid = request.args.get('runid')
    testid = request.args.get('testid')

    profileDir = current_app.old_config.profileDir

    idx = 0
    tlc = {}
    sample = ts.query(ts.Sample) \
               .filter(ts.Sample.run_id == runid) \
               .filter(ts.Sample.test_id == testid).first()
    if sample and sample.profile:
        p = sample.profile.load(profileDir)
        return json.dumps([[n, f] for n, f in p.getFunctions().items()])
    else:
        abort(404)
示例#51
0
文件: api.py 项目: llvm-mirror/lnt
 def get(machine_id, test_id, field_index):
     """Get the regressions for a particular line in a graph."""
     session = request.session
     ts = request.get_testsuite()
     field = ts.sample_fields[field_index]
     # Maybe we don't need to do this?
     fcs = session.query(ts.FieldChange) \
         .filter(ts.FieldChange.machine_id == machine_id) \
         .filter(ts.FieldChange.test_id == test_id) \
         .filter(ts.FieldChange.field_id == field.id) \
         .all()
     fc_ids = [x.id for x in fcs]
     fc_mappings = dict(
         [(x.id, (x.end_order.as_ordered_string(), x.new_value))
          for x in fcs])
     if len(fcs) == 0:
         # If we don't find anything, lets see if we are even looking
         # for a valid thing to provide a nice error.
         try:
             session.query(ts.Machine) \
                 .filter(ts.Machine.id == machine_id) \
                 .one()
             session.query(ts.Test) \
                 .filter(ts.Test.id == test_id) \
                 .one()
             _ = ts.sample_fields[field_index]
         except (NoResultFound, IndexError):
             abort(404)
         # I think we found nothing.
         return []
     regressions = session.query(ts.Regression.title, ts.Regression.id,
                                 ts.RegressionIndicator.field_change_id,
                                 ts.Regression.state) \
         .join(ts.RegressionIndicator) \
         .filter(ts.RegressionIndicator.field_change_id.in_(fc_ids)) \
         .all()
     results = [
         {
             'title': r.title,
             'id': r.id,
             'state': r.state,
             'end_point': fc_mappings[r.field_change_id]
         }
         for r in regressions
     ]
     return results
示例#52
0
def v4_profile_ajax_getFunctions():
    ts = request.get_testsuite()
    runid = request.args.get('runid')
    testid = request.args.get('testid')

    profileDir = current_app.old_config.profileDir

    idx = 0
    tlc = {}
    sample = ts.query(ts.Sample) \
               .filter(ts.Sample.run_id == runid) \
               .filter(ts.Sample.test_id == testid).first()
    if sample and sample.profile:
        p = sample.profile.load(profileDir)
        return json.dumps([[n, f] for n,f in p.getFunctions().items()])
    else:
        abort(404);
示例#53
0
文件: views.py 项目: efcs/lnt
def v4_daily_report_overview():
    # Redirect to the report for the most recent submitted run's date.

    ts = request.get_testsuite()

    # Get the latest run.
    latest = ts.query(ts.Run).\
        order_by(ts.Run.start_time.desc()).limit(1).first()

    # If we found a run, use it's start time.
    if latest:
        date = latest.start_time
    else:
        # Otherwise, just use today.
        date = datetime.date.today()

    return redirect(v4_url_for("v4_daily_report",
                               year=date.year, month=date.month, day=date.day))
示例#54
0
    def get(machine_id, test_id, field_index):
        """Get the data for a particular line in a graph."""
        session = request.session
        ts = request.get_testsuite()
        # Maybe we don't need to do this?
        try:
            machine = session.query(ts.Machine) \
                .filter(ts.Machine.id == machine_id) \
                .one()
            test = session.query(ts.Test) \
                .filter(ts.Test.id == test_id) \
                .one()
            field = ts.sample_fields[field_index]
        except NoResultFound:
            abort(404)

        q = session.query(field.column, ts.Order.llvm_project_revision,
                          ts.Run.start_time, ts.Run.id) \
            .join(ts.Run) \
            .join(ts.Order) \
            .filter(ts.Run.machine_id == machine.id) \
            .filter(ts.Sample.test == test) \
            .filter(field.column.isnot(None)) \
            .order_by(ts.Order.llvm_project_revision.desc())

        if field.status_field:
            q = q.filter((field.status_field.column == PASS)
                         | (field.status_field.column.is_(None)))

        limit = request.values.get('limit', None)
        if limit:
            limit = int(limit)
            if limit:
                q = q.limit(limit)

        samples = [[
            convert_revision(rev), val, {
                'label': rev,
                'date': str(time),
                'runID': str(rid)
            }
        ] for val, rev, time, rid in q.all()[::-1]]
        samples.sort(key=lambda x: x[0])
        return samples
示例#55
0
文件: api.py 项目: llvm-mirror/lnt
    def get(machine_id, test_id, field_index):
        """Get the data for a particular line in a graph."""
        session = request.session
        ts = request.get_testsuite()
        # Maybe we don't need to do this?
        try:
            machine = session.query(ts.Machine) \
                .filter(ts.Machine.id == machine_id) \
                .one()
            test = session.query(ts.Test) \
                .filter(ts.Test.id == test_id) \
                .one()
            field = ts.sample_fields[field_index]
        except NoResultFound:
            abort(404)

        q = session.query(field.column, ts.Order.llvm_project_revision,
                          ts.Run.start_time, ts.Run.id) \
            .join(ts.Run) \
            .join(ts.Order) \
            .filter(ts.Run.machine_id == machine.id) \
            .filter(ts.Sample.test == test) \
            .filter(field.column.isnot(None)) \
            .order_by(ts.Order.llvm_project_revision.desc())

        if field.status_field:
            q = q.filter((field.status_field.column == PASS) |
                         (field.status_field.column.is_(None)))

        limit = request.values.get('limit', None)
        if limit:
            limit = int(limit)
            if limit:
                q = q.limit(limit)

        samples = [
            [convert_revision(rev), val,
             {'label': rev, 'date': str(time), 'runID': str(rid)}]
            for val, rev, time, rid in q.all()[::-1]
        ]
        samples.sort(key=lambda x: x[0])
        return samples
示例#56
0
 def _get_machine(machine_spec):
     ts = request.get_testsuite()
     session = request.session
     # Assume id number if machine_spec is numeric, otherwise a name.
     if machine_spec.isdigit():
         machine = session.query(ts.Machine) \
             .filter(ts.Machine.id == machine_spec).first()
     else:
         machines = session.query(ts.Machine) \
             .filter(ts.Machine.name == machine_spec).all()
         if len(machines) == 0:
             machine = None
         elif len(machines) > 1:
             abort(404, msg="Name '%s' is ambiguous; specify machine id" %
                   (machine_spec))
         else:
             machine = machines[0]
     if machine is None:
         abort(404, msg="Did not find machine '%s'" % (machine_spec,))
     return machine
示例#57
0
文件: api.py 项目: llvm-mirror/lnt
 def _get_machine(machine_spec):
     ts = request.get_testsuite()
     session = request.session
     # Assume id number if machine_spec is numeric, otherwise a name.
     if machine_spec.isdigit():
         machine = session.query(ts.Machine) \
             .filter(ts.Machine.id == machine_spec).first()
     else:
         machines = session.query(ts.Machine) \
             .filter(ts.Machine.name == machine_spec).all()
         if len(machines) == 0:
             machine = None
         elif len(machines) > 1:
             abort(404, msg="Name '%s' is ambiguous; specify machine id" %
                   (machine_spec))
         else:
             machine = machines[0]
     if machine is None:
         abort(404, msg="Did not find machine '%s'" % (machine_spec,))
     return machine
示例#58
0
    def post(machine_spec):
        session = request.session
        ts = request.get_testsuite()
        machine = Machine._get_machine(machine_spec)
        machine_name = "%s:%s" % (machine.name, machine.id)

        action = request.values.get('action', None)
        if action is None:
            abort(400, msg="No 'action' specified")
        elif action == 'rename':
            name = request.values.get('name', None)
            if name is None:
                abort(400, msg="Expected 'name' for rename request")
            existing = session.query(ts.Machine) \
                .filter(ts.Machine.name == name) \
                .first()
            if existing is not None:
                abort(400, msg="Machine with name '%s' already exists" % name)
            machine.name = name
            session.commit()
            logger.info("Renamed machine %s to %s" % (machine_name, name))
        elif action == 'merge':
            into_id = request.values.get('into', None)
            if into_id is None:
                abort(400, msg="Expected 'into' for merge request")
            into = Machine._get_machine(into_id)
            into_name = "%s:%s" % (into.name, into.id)
            session.query(ts.Run) \
                .filter(ts.Run.machine_id == machine.id) \
                .update({ts.Run.machine_id: into.id},
                        synchronize_session=False)
            session.expire_all()  # be safe after synchronize_session==False
            # re-query Machine so we can delete it.
            machine = Machine._get_machine(machine_spec)
            session.delete(machine)
            session.commit()
            logger.info("Merged machine %s into %s" %
                        (machine_name, into_name))
            logger.info("Deleted machine %s" % machine_name)
        else:
            abort(400, msg="Unknown action '%s'" % action)
示例#59
0
文件: api.py 项目: llvm-mirror/lnt
    def post(machine_spec):
        session = request.session
        ts = request.get_testsuite()
        machine = Machine._get_machine(machine_spec)
        machine_name = "%s:%s" % (machine.name, machine.id)

        action = request.values.get('action', None)
        if action is None:
            abort(400, msg="No 'action' specified")
        elif action == 'rename':
            name = request.values.get('name', None)
            if name is None:
                abort(400, msg="Expected 'name' for rename request")
            existing = session.query(ts.Machine) \
                .filter(ts.Machine.name == name) \
                .first()
            if existing is not None:
                abort(400, msg="Machine with name '%s' already exists" % name)
            machine.name = name
            session.commit()
            logger.info("Renamed machine %s to %s" % (machine_name, name))
        elif action == 'merge':
            into_id = request.values.get('into', None)
            if into_id is None:
                abort(400, msg="Expected 'into' for merge request")
            into = Machine._get_machine(into_id)
            into_name = "%s:%s" % (into.name, into.id)
            session.query(ts.Run) \
                .filter(ts.Run.machine_id == machine.id) \
                .update({ts.Run.machine_id: into.id},
                        synchronize_session=False)
            session.expire_all()  # be safe after synchronize_session==False
            # re-query Machine so we can delete it.
            machine = Machine._get_machine(machine_spec)
            session.delete(machine)
            session.commit()
            logger.info("Merged machine %s into %s" %
                        (machine_name, into_name))
            logger.info("Deleted machine %s" % machine_name)
        else:
            abort(400, msg="Unknown action '%s'" % action)
示例#60
0
文件: views.py 项目: linkedinyou/lnt
def v4_search():
    def _isint(i):
        try:
            int(i)
            return True
        except:
            return False

    ts = request.get_testsuite()
    query = request.args.get('q')
    l = request.args.get('l', 8)
    default_machine = request.args.get('m', None)

    assert query
    results = lnt.server.db.search.search(ts, query, num_results=l,
                                          default_machine=default_machine)

    return json.dumps(
        [('%s #%s' % (r.machine.name, r.order.llvm_project_revision),
          r.id)
         for r in results])