plane.time = sample_timestamp - plane.seen plane.reporter = args.reporter if args.db_conf and dbconn: plane.logToDB(dbconn, printQuery=args.debug) else: print(plane.to_JSON()) else: if args.debug: print("Dropped report " + plane.to_JSON()) samps_taken += 1 if args.db_conf and dbconn: dbconn.commit() t2 = time.time() if samps_taken < args.num_samps or args.num_samps < 0: if (t2 - t1) < args.boredom_threshold: time.sleep(args.boredom_threshold - (t2 - t1)) else: inputfile = pr.openFile(args.datafile) data = pr.readFromFile(inputfile) while data: for plane in data: if not plane.reporter: plane.reporter = args.reporter if dbconn: plane.logToDB(dbconn, printQuery=args.debug) else: print(plane.to_JSON()) if dbconn: dbconn.commit() data = pr.readFromFile(inputfile)
plane.time = sample_timestamp - plane.seen plane.reporter = args.reporter if args.db_conf and dbconn: plane.logToDB(dbconn, printQuery=args.debug) else: print(plane.to_JSON()) else: if args.debug: print("Dropped report " + plane.to_JSON()) samps_taken += 1 if args.db_conf and dbconn: dbconn.commit() t2 = time.time() if samps_taken < args.num_samps or args.num_samps < 0: if (t2 - t1) < args.boredom_threshold: time.sleep(args.boredom_threshold - (t2 - t1)) else: inputfile = pr.openFile(args.datafile) data = pr.readFromFile(inputfile, numRecs=args.numrecs) while data: for plane in data: if not plane.reporter: plane.reporter = args.reporter if dbconn: plane.logToDB(dbconn, printQuery=args.debug) else: print(plane.to_JSON()) if dbconn: dbconn.commit() data = pr.readFromFile(inputfile, numRecs=args.numrecs)