Ejemplo n.º 1
0
def its_report(dbcon, filters):
    # Per release its information

    from vizgrimoire.ITS import ITS
    ITS.set_backend("launchpad")

    project_name = filters.type_analysis[1]
    project_name = project_name.replace(" ", "")
    if project_name == 'Documentation':
        ITS._get_backend(
        ).closed_condition = "(new_value='Fix Committed' or new_value='Fix Released')"
    else:
        ITS.closed_condition = "(new_value='Fix Committed')"

    opened = its.Opened(dbcon, filters)
    createJSON(opened.get_agg(),
               "./release/its_opened_" + project_name + ".json")
    closed = its.Closed(dbcon, filters)
    createJSON(closed.get_agg(),
               "./release/its_closed_" + project_name + ".json")

    dataset = {}
    dataset["opened"] = opened.get_agg()["opened"]
    dataset["closed"] = closed.get_agg()["closed"]

    return dataset
Ejemplo n.º 2
0
def projects_efficiency(opts, people_out, affs_out):
    # BMI and time to review in mean per general project
    scr_dbcon = SCRQuery(opts.dbuser, opts.dbpassword, opts.dbreview, opts.dbidentities)
    scm_dbcon = SCMQuery(opts.dbuser, opts.dbpassword, opts.dbcvsanaly, opts.dbidentities)
    its_dbcon = ITSQuery(opts.dbuser, opts.dbpassword, opts.dbbicho, opts.dbidentities)

    projects = integrated_projects(scm_dbcon)

    projects_ids = projects["subproject_id"]
    projects_list = []
    bmi_list = []
    time2review_list = []
    bmi_its = []

    period = "month"
    releases = opts.releases.split(",")[-2:]
    startdate = "'"+releases[0]+"'"
    enddate = "'"+releases[1]+"'"

    for project_id in projects_ids:
        project_title = "'" + project_id + "'"
        type_analysis = ["project", project_id]
        project_filters = MetricFilters(period, startdate, enddate, type_analysis, 10,
                                        people_out, affs_out)
        scr_bmi = scr.BMISCR(scr_dbcon, project_filters)
        time2review = scr.TimeToReview(scr_dbcon, project_filters)
   
        # ITS BMI index
        from vizgrimoire.ITS import ITS
        ITS.set_backend("launchpad")

        if project_id == 'Documentation':
            ITS._get_backend().closed_condition = "(new_value='Fix Committed' or new_value='Fix Released')"
        else:
            ITS.closed_condition = "(new_value='Fix Committed')"

        opened = its.Opened(its_dbcon, project_filters)
        closed = its.Closed(its_dbcon, project_filters)

        tickets_opened = opened.get_agg()["opened"]
        tickets_closed = closed.get_agg()["closed"]

        its_bmi = 0
        if tickets_closed > 0:
           its_bmi = round(float(tickets_closed)/float(tickets_opened), 2)


        projects_list.append(project_id)
        bmi_list.append(round(scr_bmi.get_agg()["bmiscr"], 2))
        time2review_list.append(round(time2review.get_agg()["review_time_days_median"], 2))
        bmi_its.append(its_bmi)


    createCSV({"projects":projects_list, "bmi":bmi_list, "timereview":time2review_list, "bmiits":bmi_its}, "./release/integrated_projects_efficiency.csv")    
Ejemplo n.º 3
0
    def result(self, data_source = None):
        from vizgrimoire.ITS import ITS
        if data_source is not None and data_source != ITS: return None
        period = self.filters.period
        startdate = self.filters.startdate
        enddate = self.filters.enddate
        idb = self.db.identities_db
        from vizgrimoire.ITS import ITS
        backend = ITS._get_backend()

        self.CreateViews()
        time_to_response = self.ticketsTimeToResponse(period, startdate, enddate, idb, backend)
        time_from_opened = self.ticketsTimeOpened(period, startdate, enddate, idb, backend)
        return dict(time_to_response.items() + time_from_opened.items())
Ejemplo n.º 4
0
def create_json(dbcon, filters):

    ITS.set_backend("jira")
    ITS._get_backend().closed_condition = " i.status = 'Closed' "

    pullrequests = PullRequests(dbcon, filters)
    submitters = Submitters(dbcon, filters)
    abandoned = Abandoned(dbcon, filters)
    merged = Merged(dbcon, filters)
    trackers = Trackers(dbcon, filters)

    #timeseries data
    data = dict(pullrequests.get_ts().items() +
                submitters.get_ts().items() +
                abandoned.get_ts().items() +
                merged.get_ts().items() +
                trackers.get_ts().items())
    if filters.type_analysis == []:
        createJSON(data, "scr-evolutionary.json")
    else:
        tracker = filters.type_analysis[1]
        tracker = tracker.replace("'", "")
        name = tracker.split("/")[-1:][0]
        createJSON(data, name + "-scr-evolutionary.json")

    #aggregated data
    data = dict(pullrequests.get_agg().items() +
                submitters.get_agg().items() +
                abandoned.get_agg().items() +
                merged.get_agg().items() +
                trackers.get_agg().items())

    enddate = filters.enddate

    for i in [7, 365, 0]:
        data = dict(data.items() +
                    pullrequests.get_trends(enddate, i).items() +
                    submitters.get_trends(enddate, i).items() +
                    abandoned.get_trends(enddate, i).items() +
                    merged.get_trends(enddate, i).items() +
                    trackers.get_trends(enddate, i).items())

    if filters.type_analysis == []:
        createJSON(data, "scr-static.json")
    else:
        tracker = filters.type_analysis[1]
        tracker = tracker.replace("'", "")
        name = tracker.split("/")[-1:][0]
        createJSON(data, name + "-scr-static.json")
Ejemplo n.º 5
0
def create_json(dbcon, filters):

    ITS.set_backend("jira")
    ITS._get_backend().closed_condition = " i.status = 'Closed' "

    pullrequests = PullRequests(dbcon, filters)
    submitters = Submitters(dbcon, filters)
    abandoned = Abandoned(dbcon, filters)
    merged = Merged(dbcon, filters)
    trackers = Trackers(dbcon, filters)

    #timeseries data
    data = dict(pullrequests.get_ts().items() + submitters.get_ts().items() +
                abandoned.get_ts().items() + merged.get_ts().items() +
                trackers.get_ts().items())
    if filters.type_analysis == []:
        createJSON(data, "scr-evolutionary.json")
    else:
        tracker = filters.type_analysis[1]
        tracker = tracker.replace("'", "")
        name = tracker.split("/")[-1:][0]
        createJSON(data, name + "-scr-evolutionary.json")

    #aggregated data
    data = dict(pullrequests.get_agg().items() + submitters.get_agg().items() +
                abandoned.get_agg().items() + merged.get_agg().items() +
                trackers.get_agg().items())

    enddate = filters.enddate

    for i in [7, 365, 0]:
        data = dict(data.items() +
                    pullrequests.get_trends(enddate, i).items() +
                    submitters.get_trends(enddate, i).items() +
                    abandoned.get_trends(enddate, i).items() +
                    merged.get_trends(enddate, i).items() +
                    trackers.get_trends(enddate, i).items())

    if filters.type_analysis == []:
        createJSON(data, "scr-static.json")
    else:
        tracker = filters.type_analysis[1]
        tracker = tracker.replace("'", "")
        name = tracker.split("/")[-1:][0]
        createJSON(data, name + "-scr-static.json")
Ejemplo n.º 6
0
    def result(self, data_source = None):
        # FIXME: this import is needed to get the list of
        # states available on the tracker. This should be moved
        # to configuration file to let the user choose among states.
        from vizgrimoire.ITS import ITS
        if data_source is not None and data_source != ITS: return None
        backend = ITS._get_backend()

        if backend.its_type == 'bg':
            backend_type = 'bugzilla'
        else:
            backend_type = backend.its_type

        states = self.get_state_types(backend_type)

        backlog = self.get_backlog(states, backend_type)
        current_states = self.get_current_states(states)
        return dict(backlog.items() + current_states.items())
Ejemplo n.º 7
0
def its_report(dbcon, filters):
    # Per release its information

    from vizgrimoire.ITS import ITS
    ITS.set_backend("launchpad")

    project_name = filters.type_analysis[1]
    project_name = project_name.replace(" ", "")
    if project_name == 'Documentation':
        ITS._get_backend().closed_condition = "(new_value='Fix Committed' or new_value='Fix Released')"
    else:
        ITS.closed_condition = "(new_value='Fix Committed')"

    opened = its.Opened(dbcon, filters)
    createJSON(opened.get_agg(), "./release/its_opened_"+project_name+".json")
    closed = its.Closed(dbcon, filters)
    createJSON(closed.get_agg(), "./release/its_closed_"+project_name+".json")

    dataset = {}
    dataset["opened"] = opened.get_agg()["opened"]
    dataset["closed"] = closed.get_agg()["closed"]

    return dataset
Ejemplo n.º 8
0
    def result(self, data_source = None):
        # FIXME: this import is needed to get the list of
        # states available on the tracker. This should be moved
        # to configuration file to let the user choose among states.
        from vizgrimoire.ITS import ITS
        if data_source is not None and data_source != ITS: return None
        backend = ITS._get_backend()

        if backend.its_type == 'bg':
            backend_type = 'bugzilla'
        else:
            backend_type = backend.its_type

        states = self.get_state_types(backend_type)

        backlog = self.get_backlog(states, backend_type)
        current_states = self.get_current_states(states)
        data = dict(backlog.items() + current_states.items())

        prep_data = {}

        # Capitalize first letter to avoid collision with other metrics
        capitalize = lambda s: s[0].upper() + s[1:]

        for k in data:
            if k in ['id', 'date', 'month', 'unixtime']:
                prep_data[k] = data[k]
            else:
                if k.startswith('current_'):
                    state = capitalize(k.partition('_')[2])
                    state = 'current_' + state
                else:
                    state = capitalize(k)

                prep_data[state] = data[k]

        return prep_data
Ejemplo n.º 9
0
def projects_efficiency(opts, people_out, affs_out):
    # BMI and time to review in mean per general project
    scr_dbcon = SCRQuery(opts.dbuser, opts.dbpassword, opts.dbreview,
                         opts.dbidentities, opts.dbprojects)
    scm_dbcon = SCMQuery(opts.dbuser, opts.dbpassword, opts.dbcvsanaly,
                         opts.dbidentities, opts.dbprojects)
    its_dbcon = ITSQuery(opts.dbuser, opts.dbpassword, opts.dbbicho,
                         opts.dbidentities, opts.dbprojects)

    projects = integrated_projects(scm_dbcon)

    projects_ids = projects["subproject_id"]
    projects_list = []
    bmi_list = []
    time2review_list = []
    bmi_its = []

    period = "month"
    releases = opts.releases.split(",")[-2:]
    startdate = "'" + releases[0] + "'"
    enddate = "'" + releases[1] + "'"

    for project_id in projects_ids:
        project_title = "'" + project_id + "'"
        type_analysis = ["project", project_id]
        project_filters = MetricFilters(period, startdate, enddate,
                                        type_analysis, 10, people_out,
                                        affs_out)
        scr_bmi = scr.BMISCR(scr_dbcon, project_filters)
        time2review = scr.TimeToReview(scr_dbcon, project_filters)

        # ITS BMI index
        from vizgrimoire.ITS import ITS
        ITS.set_backend("launchpad")

        if project_id == 'Documentation':
            ITS._get_backend(
            ).closed_condition = "(new_value='Fix Committed' or new_value='Fix Released')"
        else:
            ITS.closed_condition = "(new_value='Fix Committed')"

        opened = its.Opened(its_dbcon, project_filters)
        closed = its.Closed(its_dbcon, project_filters)

        tickets_opened = opened.get_agg()["opened"]
        tickets_closed = closed.get_agg()["closed"]

        its_bmi = 0
        if tickets_closed > 0:
            its_bmi = round(float(tickets_closed) / float(tickets_opened), 2)

        projects_list.append(project_id)
        bmi_list.append(round(scr_bmi.get_agg()["bmiscr"], 2))
        time2review_list.append(
            round(time2review.get_agg()["review_time_days_median"], 2))
        bmi_its.append(its_bmi)

    createCSV(
        {
            "projects": projects_list,
            "bmi": bmi_list,
            "timereview": time2review_list,
            "bmiits": bmi_its
        }, "./release/integrated_projects_efficiency.csv")
Ejemplo n.º 10
0
        tracker = filters.type_analysis[1]
        tracker = tracker.replace("'", "")
        name = tracker.split("/")[-1:][0]
        createJSON(data, name + "-scr-static.json")


if __name__ == '__main__':

    # PYTHONPATH=./:../../:../analysis/:../ python scr_jira_metrics.py
    filters = MetricFilters("month", "'2008-10-20'", "'2014-10-01'", [])
    dbcon = ITSQuery("root", "", "lcanas_bicho_gerrit_liferay_4444", "lcanas_cvsanaly_liferay_4444")

    create_json(dbcon, filters)

    ITS.set_backend("jira")
    ITS._get_backend().closed_condition = " i.status = 'Closed' "
    #per tracker data
    trackers = Trackers(dbcon, filters)
    trackers_list = trackers.get_list()
    trackers_names = []
    for tracker in trackers_list["name"]:
        tracker_name = tracker.split("/")[-1:][0]
        trackers_names.append(tracker_name)
        tracker_str = "'" + tracker + "'"
        filters = MetricFilters("month", "'2008-10-20'", "'2014-10-01'", ['repository', tracker_str])
        create_json(dbcon, filters)

    createJSON({"name":trackers_names}, "scr-repos.json")

    organizations = Companies(dbcon, filters)
    organizations_list = organizations.get_list()
Ejemplo n.º 11
0
        tracker = tracker.replace("'", "")
        name = tracker.split("/")[-1:][0]
        createJSON(data, name + "-scr-static.json")


if __name__ == '__main__':

    # PYTHONPATH=./:../../:../analysis/:../ python scr_jira_metrics.py
    filters = MetricFilters("month", "'2008-10-20'", "'2014-10-01'", [])
    dbcon = ITSQuery("root", "", "lcanas_bicho_gerrit_liferay_4444",
                     "lcanas_cvsanaly_liferay_4444")

    create_json(dbcon, filters)

    ITS.set_backend("jira")
    ITS._get_backend().closed_condition = " i.status = 'Closed' "
    #per tracker data
    trackers = Trackers(dbcon, filters)
    trackers_list = trackers.get_list()
    trackers_names = []
    for tracker in trackers_list["name"]:
        tracker_name = tracker.split("/")[-1:][0]
        trackers_names.append(tracker_name)
        tracker_str = "'" + tracker + "'"
        filters = MetricFilters("month", "'2008-10-20'", "'2014-10-01'",
                                ['repository', tracker_str])
        create_json(dbcon, filters)

    createJSON({"name": trackers_names}, "scr-repos.json")

    organizations = Companies(dbcon, filters)