Пример #1
0
def main(ifile):
	# open ifile and read in
	try:
		for i in open(ifile):
			#line_value=i[0:-1]
			line_value=string.strip(i)	
			if len(line_value)>0:
				vaconf_db.all_lines.append(line_value)
			else:
				continue
	except IOError as e:
		print "I/O error({0}): {1}".format(e.errno, e.strerror)
		sys.exit()
	except:
	        print "Unexpected error:", sys.exc_info()[0]

	#vaconf_db.dbgDumpLines("The whole file", vaconf_db.all_lines)
        
	# connect database
	vaconf_db.connectDB()
	
	#read in ifile and prepare the sections
	cam_site=vaconf_db.all_lines.index('[CAM]')
	F10_site=vaconf_db.all_lines.index('[F10]')
	F20_site=vaconf_db.all_lines.index('[F20]')
	F30_site=vaconf_db.all_lines.index('[F30]')
	F40_site=vaconf_db.all_lines.index('[F40]')
	F50_site=vaconf_db.all_lines.index('[F50]')

	vaconf_db.cam_lines=vaconf_db.all_lines[cam_site+1:F10_site]
	#print vaconf_db.cam_lines
	#vaconf_db.dbgDumpLines('[CAM]', vaconf_db.cam_lines)
	if F10_site+1<F20_site:
		vaconf_db.F10_lines=vaconf_db.all_lines[F10_site+1:F20_site]
		#dbgDumpLines('[F10]', vaconf_db.F10_lines)
	if F20_site+1<F30_site:
		vaconf_db.F20_lines=vaconf_db.all_lines[F20_site+1:F30_site]
		#dbgDumpLines('[F20]', vaconf_db.F20_lines)
	if F30_site+1<F40_site:
		vaconf_db.F30_lines=vaconf_db.all_lines[F30_site+1:F40_site]
		#dbgDumpLines('[F30]', vaconf_db.F30_lines)
	if F40_site+1<F50_site:
		vaconf_db.F40_lines=vaconf_db.all_lines[F40_site+1:F50_site]
		#print vaconf_db.F40_lines
		#dbgDumpLines('[F40]', vaconf_db.F40_lines)
	if F50_site+1<len(vaconf_db.all_lines):
		vaconf_db.F50_lines=vaconf_db.all_lines[F50_site+1:]
		#dbgDumpLines('[F50]', vaconf_db.F50_lines)
    
	#parse sections one by one
	vaconf_p_cam.parse_CAM()
	vaconf_p_f10.parse_F10()
	vaconf_p_f20.parse_F20()
	vaconf_p_f30.parse_F30()
	vaconf_p_f40.parse_F40()
	vaconf_p_f50.parse_F50()
	  
	#close database
	vaconf_db.closeDB()
Пример #2
0
def main(file_name):
	global incount_list
	global outcount_list
	global end_init
	try:
		vaconf_db.connectDB()
		func_tbl(va_func)
		incount_list = []
		outcount_list = []
		for i in open(file_name):
			line=string.strip(i)
			print line
			line_ID=line
			begin_time=str(format_time(start_time))
			#print 'begin_time',begin_time
			end_time=count_time(begin_time,interval_time)
			#print 'end_time',end_time
			end_stamp=unix_time(end_time)
			fini_time=format_time(finish_time)
			fini_stamp=unix_time(fini_time)
			while end_stamp <= fini_stamp:
				#print end_stamp,fini_stamp
				#print end_time,fini_time
				incount_sum=0
				outcount_sum=0
				F10_dump_sum_time_line(func_tbl,begin_time,end_time,line_ID)
				begin_time=str(count_time(begin_time,add_time))
				end_time=str(count_time(str(end_time),add_time))
				end_stamp=unix_time(end_time)
				print 'end_time>>>>>',end_time
			print incount_list
			print outcount_list
			for in_sum in incount_list:
				write_od(str(in_sum))
			for out_sum in outcount_list:
				write_od(str(out_sum))
			
			incount_list = []
			outcount_list = []
			
		vaconf_db.closeDB()


        except BaseException, e:
                print 'Unknown error (',str(e),') happened in od_analysis ! '
                return None	
Пример #3
0
def main(file_name):
	global lines_list
	global incount_list
	global outcount_list
	try:
		vaconf_db.connectDB()
		lines_list=[]
		for i in open(file_name):
			line=string.strip(i)
			lines_list.append(line)
			line_ID=line
		#print lines_list

		F10_dump_line_time(start_time,finish_time,interval_time,add_time)
		
		open_file()
		for line_ID in lines_list:
			print line_ID
			incount_list = []
			outcount_list = []

			for site in range(0,len(be_time_list)):
				begin_time=be_time_list[site]
				end_time=ed_time_list[site]
				F10_dump_sum_time_line(begin_time,end_time,line_ID)
			#print incount_list
			#print outcount_list

			for incount in incount_list:
				#print incount
				write_od(str(incount))
			for outcount in outcount_list:
				#print outcount
				write_od(str(outcount))

			incount_list = []
			outcount_list = []

		close_file()
		vaconf_db.closeDB()


        except BaseException, e:
                print 'Unknown error (',str(e),') happened in od_analysis ! '
                return None	
Пример #4
0
def main():
		
	try:
		vaconf_db.connectDB()
		
		vaconf_p_dump.open_file()
		#************ creat CAM conf *********
		vaconf_p_dump.write_conf('[CAM]')
		vaconf_p_cam.cam_dump()


		#************ creat F10 conf *********
		vaconf_p_dump.write_conf('[F10]')
		vaconf_p_f10.f10_dump()
		

		#************ creat F20 conf *********
		vaconf_p_dump.write_conf('[F20]')
		vaconf_p_f20.f20_dump()
	
		#************ creat F30 conf *********
		vaconf_p_dump.write_conf('[F30]')
		vaconf_p_f30.f30_dump()

		#************ creat F40 ***************	
		vaconf_p_dump.write_conf('[F40]')
		vaconf_p_f40.f40_dump()

	        #************ creat F50 conf *********
		vaconf_p_dump.write_conf('[F50]')

		vaconf_p_dump.close_file()
		
		vaconf_db.closeDB()
	        
		

		
	except BaseException, e:
		print 'Unknown error (',str(e),') happened in vaconf_p_dump!'