Пример #1
0
def before_request():
	g.db = connect_db()
	Slot_Conf.set_db(g.db)
	Job.set_db(g.db) 
	TimeInfo.set_db(g.db)
	slotStartEnd.set_db(g.db)
	Projects.set_db(g.db)
	Results.set_db(g.db)
	ProjNames.set_db(g.db)
	SlotTimes.set_db(g.db)
	ProjectTimes.set_db(g.db)
Пример #2
0
def before_request():
    g.db = connect_db()
    Slot_Conf.set_db(g.db)
    Job.set_db(g.db)
    TimeInfo.set_db(g.db)
    slotStartEnd.set_db(g.db)
    Projects.set_db(g.db)
    Results.set_db(g.db)
    ProjNames.set_db(g.db)
    SlotTimes.set_db(g.db)
    ProjectTimes.set_db(g.db)
Пример #3
0
def slotsResults(slot_name):
	
	#today = time.strftime("%Y-%m-%d")
	 
        slots = Slot_Conf.view('statistics/Slots',key=today)
        projects = ProjNames.view('statistics/projectsInSlot',key=[today,slot_name])
        results = Results.view('statistics/slotsResults',key=[today,slot_name])

        platforms = []
        for s in slots:
                if s.slot==slot_name:
                        platforms = s.platforms

        dopedict = {}
        for p in platforms:
                dopedict[p] = {}
                dopedict[p]['tests-result'] = []
                dopedict[p]['build-result'] = []

        for r in results:
                dopedict[r.platform][r.set].append(r.project)

        for n in projects:
                names = n.names
        
	keys = dict((n,k) for k,n in enumerate(names))

        for p in platforms:
                dopedict[p]['tests-missing'] = filter(lambda x: x not in dopedict[p]['tests-result'],names)
                dopedict[p]['build-missing'] = filter(lambda x: x not in dopedict[p]['build-result'],names)

        resultsdict = {}
        resultsdict['unstarted']=[]
        resultsdict['unfinished']=[]
        for p in platforms:
                resultsdict['unstarted' ]+=dopedict[p]['build-missing']
                resultsdict['unfinished']+=dopedict[p]['tests-missing']

        finished = sorted(set(names)-set(resultsdict['unfinished']), key=keys.get)
        unstarted = list(set(resultsdict['unstarted']))
        unfinished = list(set(resultsdict['unfinished'])-set(resultsdict['unstarted']))

        data=[]
        data.append({"total":len(results),"projects":names,"slot":slot_name,"platforms":platforms,"dopedict":dopedict,"unstarted":unstarted,"unfinished":unfinished,"finished":finished})
        data = json.dumps(data)

        return data
Пример #4
0
def slotResult(slot_name):

    slots = Slot_Conf.view('statistics/Slots', key=today)
    projects = ProjNames.view('statistics/projectsInSlot',
                              key=[today, slot_name])
    results = Results.view('statistics/slotsResults', key=[today, slot_name])

    platforms = []
    for s in slots:
        if s.slot == slot_name:
            platforms = s.platforms

    for p in projects:
        names = p.names

    dopedict = {}
    for p in platforms:
        dopedict[p] = {}
        dopedict[p]['tests-result'] = []
        dopedict[p]['build-result'] = []

    data = {}

    for n in names:
        data[n] = {}
        for p in platforms:
            data[n][p] = {}
            data[n][p]['tests-result'] = {
                "started": today + "T" + "00:00:00",
                "completed": today + "T" + "00:00:00"
            }
            data[n][p]['build-result'] = {
                "started": today + "T" + "00:00:00",
                "completed": today + "T" + "00:00:00"
            }

    for r in results:
        data[r.project][r.platform][r.set] = {
            "started": r.started,
            "completed": r.completed
        }

    data = json.dumps(data)
    return data
Пример #5
0
def projectTimes(slot_name, platform_name):
    #today = time.strftime("%Y-%m-%d")

    data = {}
    data["build"] = {}
    data["tests"] = {}
    projects = ProjNames.view('statistics/projectsInSlot',
                              key=[today, slot_name])

    for p in projects:
        data["projects"] = p.names
        for n in data["projects"]:
            data["build"][n] = {}
            data["tests"][n] = {}
            data["build"][n]['start_build'] = today + 'T' + '00:00:00'
            data["build"][n]['complet_build'] = today + 'T' + '00:00:00'
            data["tests"][n]['start_build'] = today + 'T' + '00:00:00'
            data["tests"][n]['complet_build'] = today + 'T' + '00:00:00'

    build_times = ProjectTimes.view(
        'statistics/projectTimes',
        key=[slot_name, platform_name, today, "build-result"])
    for t in build_times:
        data["build"][t.project]['start_build'] = today + 'T' + t.started
        data["build"][t.project]['complet_build'] = today + 'T' + t.completed

    tests_times = ProjectTimes.view(
        'statistics/projectTimes',
        key=[slot_name, platform_name, today, "tests-result"])

    for t in tests_times:
        data["tests"][t.project]['start_build'] = today + 'T' + t.started
        data["tests"][t.project]['complet_build'] = today + 'T' + t.completed

    data = json.dumps(data)

    return data
Пример #6
0
def projectTimes(slot_name,platform_name):
	#today = time.strftime("%Y-%m-%d")
	 

        data = {}
        data["build"] = {}
        data["tests"] = {}
        projects = ProjNames.view('statistics/projectsInSlot',key=[today,slot_name])

        for p in projects:
                data["projects"] = p.names
                for n in data["projects"]:
                        data["build"][n]={}
                        data["tests"][n]={}
                        data["build"][n]['start_build'] = today+'T'+'00:00:00'
                        data["build"][n]['complet_build'] = today+'T'+'00:00:00'
                        data["tests"][n]['start_build'] = today+'T'+'00:00:00'
                        data["tests"][n]['complet_build'] = today+'T'+'00:00:00'




        build_times = ProjectTimes.view('statistics/projectTimes',key=[slot_name,platform_name,today,"build-result"])
        for t in build_times:
                data["build"][t.project]['start_build'] = today+'T'+t.started
                data["build"][t.project]['complet_build'] = today+'T'+t.completed

        tests_times = ProjectTimes.view('statistics/projectTimes',key=[slot_name,platform_name,today,"tests-result"])

        for t in tests_times:
                data["tests"][t.project]['start_build'] = today+'T'+t.started
                data["tests"][t.project]['complet_build'] = today+'T'+t.completed

        data = json.dumps(data)

        return data
Пример #7
0
def slotResult(slot_name):

        slots = Slot_Conf.view('statistics/Slots',key=today)
        projects = ProjNames.view('statistics/projectsInSlot',key=[today,slot_name])
        results = Results.view('statistics/slotsResults',key=[today,slot_name])

        platforms = []
        for s in slots:
                if s.slot==slot_name:
                        platforms = s.platforms

	for p in projects:
		names = p.names

        dopedict = {}
        for p in platforms:
                dopedict[p] = {}
                dopedict[p]['tests-result'] = []
                dopedict[p]['build-result'] = []

	data = {}

	for n in names:
		data[n] = {}
		for p in platforms:
			data[n][p]={}
			data[n][p]['tests-result']={"started":today+"T"+"00:00:00","completed":today+"T"+"00:00:00"}
			data[n][p]['build-result']={"started":today+"T"+"00:00:00","completed":today+"T"+"00:00:00"}
		
		
        for r in results:
		data[r.project][r.platform][r.set]={"started":r.started,"completed":r.completed}

			
        data = json.dumps(data)
	return data
Пример #8
0
def slotsResults(slot_name):

    #today = time.strftime("%Y-%m-%d")

    slots = Slot_Conf.view('statistics/Slots', key=today)
    projects = ProjNames.view('statistics/projectsInSlot',
                              key=[today, slot_name])
    results = Results.view('statistics/slotsResults', key=[today, slot_name])

    platforms = []
    for s in slots:
        if s.slot == slot_name:
            platforms = s.platforms

    dopedict = {}
    for p in platforms:
        dopedict[p] = {}
        dopedict[p]['tests-result'] = []
        dopedict[p]['build-result'] = []

    for r in results:
        dopedict[r.platform][r.set].append(r.project)

    for n in projects:
        names = n.names

    keys = dict((n, k) for k, n in enumerate(names))

    for p in platforms:
        dopedict[p]['tests-missing'] = filter(
            lambda x: x not in dopedict[p]['tests-result'], names)
        dopedict[p]['build-missing'] = filter(
            lambda x: x not in dopedict[p]['build-result'], names)

    resultsdict = {}
    resultsdict['unstarted'] = []
    resultsdict['unfinished'] = []
    for p in platforms:
        resultsdict['unstarted'] += dopedict[p]['build-missing']
        resultsdict['unfinished'] += dopedict[p]['tests-missing']

    finished = sorted(set(names) - set(resultsdict['unfinished']),
                      key=keys.get)
    unstarted = list(set(resultsdict['unstarted']))
    unfinished = list(
        set(resultsdict['unfinished']) - set(resultsdict['unstarted']))

    data = []
    data.append({
        "total": len(results),
        "projects": names,
        "slot": slot_name,
        "platforms": platforms,
        "dopedict": dopedict,
        "unstarted": unstarted,
        "unfinished": unfinished,
        "finished": finished
    })
    data = json.dumps(data)

    return data