Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/python/bin/gnuboat-data-generator

    re561143 re44e1f1  
    4646    global logperiod
    4747
    48     parser = argparse.ArgumentParser(description='Generates test data for gnuboat webservice and fills the rrd database')
     48    parser = argparse.ArgumentParser(description="Generates test data for gnuboat webservice and fills the rrd database")
    4949    parser.add_argument('-f', '--file', dest='rrd_database', metavar='rrd_database', type=str,
    5050                        help='File path of the rrd database to fill', default="/var/lib/gnuboat/gnuboat.rrd")
    … …  
    7878
    7979    if not os.path.exists(os.path.dirname(rrdfile)):
    80         print('rrd database directory not found {}'.format(os.path.dirname(rrdfile)))
     80        print "rrd database directory not found %s" % os.path.dirname(rrdfile)
     81        print ""
    8182        parser.print_help()
    8283        sys.exit(2)
    … …  
    8687       
    8788    if os.path.isfile(rrdfile):
    88         print('Removing old database {}'.format(rrdfile))
     89        print "Removing old database %s" % rrdfile
    8990        os.remove(rrdfile)
    9091
    91     print('Creating {}'.format(rrdfile))
     92    print "Creating %s" % rrdfile
    9293    daemon.rrd_create_database(rrdfile, logperiod, str(start_time))
    9394   
    94     print('Filling database inside [{}, {}] --> [{}, {}]...'.format(latitude_min, longitude_min, latitude_max, longitude_max))
     95    print "Filling database inside [%s, %s] --> [%s,%s]..." % (latitude_min, longitude_min, latitude_max, longitude_max)
    9596    for current_time in xrange(timestamp - duration, timestamp, logperiod):
    9697        latitude = random.uniform(latitude_min, latitude_max)
    … …  
    103104        gpsFix = 3
    104105        # update rrd database for the webservice
    105         daemon.rrd_update(rrdfile, '{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}'.format(
     106        daemon.rrd_update(rrdfile, "%s:%s:%s:%s:%s:%s:%s:%s:%s" % (
    106107                       current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
    107108
Note: See TracChangeset for help on using the changeset viewer.