def get_product_success_rate(pjid, **kwargs):
    passed_ctx, passed = aggregate(store, 'metrics:total-passed-product-jobs:{}'.format(pjid), kwargs['begin'],
                                   kwargs['end'],
                                   kwargs['max'])

    total_ctx, total = aggregate(store, 'metrics:total-product-jobs:{}'.format(pjid), kwargs['begin'], kwargs['end'],
                                 kwargs['max'])

    # When there are no executions (t == 0), rate should be equal to 1??
    rate = [float(r) / float(t) if t else 0 for r, t in zip(passed, total)]
    return total_ctx, rate
def get_member_activity_in_repository(rid, mid, **kwargs):
    committer_id = store.get_member_id(mid)
    context, member_res = aggregate(store, 'metrics:total-repo-member-commits:{}:{}'.format(rid, committer_id),
                                    kwargs['begin'],
                                    kwargs['end'],
                                    kwargs['max'])
    kwargs['begin'] = int(context['begin'])
    kwargs['end'] = int(context['end'])
    kwargs['max'] = len(member_res)
    try:
        _, repo_res = aggregate(store, 'metrics:total-repo-commits:{}'.format(rid), kwargs['begin'],
                                kwargs['end'],
                                kwargs['max'])
        activity = [float(m) / float(g) if g else 0 for m, g in zip(member_res, repo_res)]
        return context, activity
    except (EnvironmentError, AttributeError) as e:
        raise APIError(e.message)
def get_total_org_externals(**kwargs):
    aggr = dev_aggr
    if not kwargs['max']:
        aggr = aggr_whole

    context, result = aggregate(store, 'metrics:total-externals', kwargs['begin'], kwargs['end'],
                                kwargs['max'], aggr, fill=[])
    if aggr == aggr_whole:
        result = result.pop()
    return context, result
def get_product_activity(prid, **kwargs):
    if kwargs['begin'] is None and kwargs['end'] is None:
        begin, end = store.get_product_frame(prid)
        kwargs['begin'] = begin
        kwargs['end'] = end
    context, project_res = aggregate(store, 'metrics:total-product-commits:{}'.format(prid), kwargs['begin'],
                                     kwargs['end'],
                                     kwargs['max'])
    # Align query params with the local context just obtained
    kwargs['begin'] = int(context['begin'])
    kwargs['end'] = int(context['end'])
    kwargs['max'] = len(project_res)
    try:
        _, global_res = aggregate(store, 'metrics:total-commits', kwargs['begin'],
                                  kwargs['end'],
                                  kwargs['max'])
        activity = [float(m) / float(g) if g else 0 for m, g in zip(project_res, global_res)]
        return context, activity
    except (EnvironmentError, AttributeError) as e:
        raise APIError(e.message)
def get_total_org_commits(**kwargs):
    return aggregate(store, 'metrics:total-commits', kwargs['begin'], kwargs['end'],
                     kwargs['max'])
def get_total_repo_commits(rid, **kwargs):
    return aggregate(store, 'metrics:total-repo-commits:{}'.format(rid), kwargs['begin'], kwargs['end'],
                     kwargs['max'])
def get_total_project_externals(prid, **kwargs):
    context, result = aggregate(store, 'metrics:total-project-externals:{}'.format(prid), kwargs['begin'],
                                kwargs['end'],
                                kwargs['max'], dev_aggr, fill=[])
    return context, result
def get_total_project_commits(prid, **kwargs):
    return aggregate(store, 'metrics:total-project-commits:{}'.format(prid), kwargs['begin'], kwargs['end'],
                     kwargs['max'])
def get_total_repo_externals(rid, **kwargs):
    aggr = dev_aggr
    return aggregate(store, 'metrics:total-repo-externals:{}'.format(rid), kwargs['begin'], kwargs['end'],
                     kwargs['max'], aggr, fill=[])
def get_avg_org_branches(**kwargs):
    return aggregate(store, 'metrics:total-branches', kwargs['begin'], kwargs['end'],
                     kwargs['max'], aggr=avg, extend=True)
def get_total_org_branches(**kwargs):
    return aggregate(store, 'metrics:total-branches', kwargs['begin'], kwargs['end'],
                     kwargs['max'])
def get_avg_member_commits(mid, **kwargs):
    committer_id = store.get_member_id(mid)
    return aggregate(store, 'metrics:total-member-commits:{}'.format(committer_id), kwargs['begin'], kwargs['end'],
                     kwargs['max'], aggr=avg, extend=True)
def get_total_repo_member_commits(rid, mid, **kwargs):
    committer_id = store.get_member_id(mid)
    return aggregate(store, 'metrics:total-repo-member-commits:{}:{}'.format(rid, committer_id), kwargs['begin'],
                     kwargs['end'],
                     kwargs['max'])
Beispiel #14
0
def get_total_passed_repo_executions(rid, **kwargs):
    return aggregate(store, 'metrics:total-passed-repo-jobs:{}'.format(rid), kwargs['begin'], kwargs['end'],
                     kwargs['max'])
Beispiel #15
0
def get_total_failed_executions(**kwargs):
    return aggregate(store, 'metrics:total-failed-jobs', kwargs['begin'], kwargs['end'], kwargs['max'])
Beispiel #16
0
def get_project_failed_executions(prid, **kwargs):
    return aggregate(store, 'metrics:total-failed-project-jobs:{}'.format(prid), kwargs['begin'], kwargs['end'],
                     kwargs['max'])