예제 #1
0
        for zone in range(-12, 12):
            col = 0
            for field in fields:
                timezones[field].append(tz[zone][col])
                col = col + 1
        return timezones


if __name__ == "__main__":

    from grimoirelib_alch.aux.standalone import stdout_utf8, print_banner
    from datetime import datetime
    import jsonpickle
    import csv

    stdout_utf8()

    database = DB(url='mysql://*****:*****@localhost/',
                  schema='oscon_opennebula_scm_tz',
                  schema_id='oscon_opennebula_scm_tz')
    session = database.build_session(query_cls=Query, echo=False)

    #---------------------------------
    print_banner("Activity per timezone, raw from database")
    res = session.query().select_tz()
    res = res.filter_period(start=datetime(2014, 1, 1),
                            end=datetime(2014, 7, 1))
    res = res.group_by_tz()

    print res
    print res.all()
예제 #2
0
        # Get the session for this query, use it for getting org ids,
        # and build the filter
        session = inspect(query).session
        query_orgs = session.query().select_orgs() \
            .filter_orgs (self.org_names)
        self.org_ids = [org.org_id for org in query_orgs.all()]
        return query.filter_org_ids(list = self.org_ids,
                                    kind = self.actors)


if __name__ == "__main__":

    from grimoirelib_alch.aux.standalone import stdout_utf8, print_banner
    from datetime import datetime

    stdout_utf8()

    database = DB (url = "mysql://*****:*****@localhost/",
                   schema = "vizgrimoire_cvsanaly",
                   schema_id = "vizgrimoire_cvsanaly")

    #---------------------------------
    print_banner ("Number of commits (timeseries, total)")
    data = SCM (datasource = database,
                name = "ncommits")
    print data.timeseries()
    print data.total()

    #---------------------------------
    print_banner ("Number of commits (timeseries, total), for period")
    period = PeriodCondition (start = datetime(2013,1,1), end = None)