コード例 #1
0
ファイル: spend_list.py プロジェクト: ljb-2000/auditsite
def spend_list(req):
	now_startTime = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
	now_time = time.strftime("%H:%M:%S",time.localtime(time.time()))
	one_month_startTime = get_date.get_today_month(-1) + ' ' + now_time
	cmd = 'select u.department,count(us.jobuser) as usernum, sum(us.jobnum) as jobnum, sum(us.mapnum) as mapnum, sum(us.reducenum) as reducenum, sum(us.totaltime) as totaltime, sum(us.totalcpucost) as totalcpucost from(select jd.jobuser,count(1) as jobnum, sum(mapsTotal) as  mapnum, sum(reducesTotal) as reducenum, sum(computeTime) as totaltime, sum(cpu_cost_time) as totalcpucost from audit_job_status_yz jd force index(startTime) where jd.startTime >= "%s" and jd.startTime <= "%s"  group by jd.jobuser) us, audit_user u where us.jobuser=u.user_name group by u.department  order by totaltime desc limit 10' %(one_month_startTime,now_startTime)

	datas = mysqlconn.mysql_conn(cmd)
		
#	return render_to_response('spend_list.html',{'datas':datas})
	
	if 'beginTime' in req.GET and 'endTime' in req.GET:
		startTime1 = req.GET.get('beginTime')
		startTime2 = req.GET.get('endTime')
		cmd1 = 'select u.department,count(us.jobuser) as usernum, sum(us.jobnum) as jobnum, sum(us.mapnum) as mapnum, sum(us.reducenum) as reducenum, sum(us.totaltime) as totaltime, sum(us.totalcpucost) as totalcpucost from(select jd.jobuser,count(1) as jobnum, sum(mapsTotal) as  mapnum, sum(reducesTotal) as reducenum, sum(computeTime) as totaltime, sum(cpu_cost_time) as totalcpucost from audit_job_status_yz jd force index(startTime) where jd.startTime >= "%s" and jd.startTime <= "%s"  group by jd.jobuser) us, audit_user u where us.jobuser=u.user_name group by u.department  order by totaltime desc limit 10' %(startTime1,startTime2)

		datas = mysqlconn.mysql_conn(cmd1)


		return render_to_response('spend_list.html',{'datas':datas})





	return render_to_response('spend_list.html',{'datas':datas})
コード例 #2
0
ファイル: welcome.py プロジェクト: ljb-2000/auditsite
def get_three_month_job():
	now_date = time.strftime("%Y-%m-%d",time.localtime(time.time()))
	three_month_ago = get_date.get_today_month(-3)
	cmd = 'select count(*) from audit_job_status_yz where finishTime>="%s" and finishTime<"%s"' %(three_month_ago,now_date)
	data = mysqlconn.mysql_conn(cmd)
	if data[0][0]:
		jobcount_three_month_ago = int(data[0][0])
	else:
		jobcount_three_month_ago = 0 
	
	return	jobcount_three_month_ago
コード例 #3
0
ファイル: welcome.py プロジェクト: ljb-2000/auditsite
def get_three_month_computeTime1():
        now_date = time.strftime("%Y-%m-%d",time.localtime(time.time()))
        three_month_ago = get_date.get_today_month(-3)
        cmd = 'select sum(computeTime) from audit_job_status_yz1 where finishTime>="%s" and finishTime<"%s"' %(three_month_ago,now_date)
        data = mysqlconn.mysql_conn(cmd)
        if data[0][0]:
		computeTime_three_month_ago1 = int(data[0][0])
	else:
		computeTime_three_month_ago1 = 0
	
	return computeTime_three_month_ago1