Exemplo n.º 1
0
def compute_statistics(configuration_file, results_directory, train_or_test,
                       statistic, outputfile):
    bag_or_instance = 'bag'
    print 'Loading configuration...'
    with open(configuration_file, 'r') as f:
        configuration = yaml.load(f)

    experiment_name = configuration['experiment_name']
    if experiment_name not in EXPERIMENTS:
        raise ValueError('No statistics supported for "%s"' % experiment_name)
    if not (bag_or_instance.startswith('b')
            or bag_or_instance.startswith('i')):
        raise ValueError('Third argument must be "bag" or "instance"')
    if train_or_test not in ('train', 'test'):
        raise ValueError('Third argument must be "train" or "test"')
    if statistic not in STATISTICS:
        raise ValueError('Statistic must be one of: "%s"' %
                         ', '.join(STATISTICS.keys()))

    stat = dict_statistic_wrapper(STATISTICS[statistic], bag_or_instance,
                                  train_or_test)
    stat_func = lambda *args: EXPERIMENTS[experiment_name](*args,
                                                           statistic=stat)

    tasks, parameters = load_config(configuration_file, results_directory)

    stat_func(configuration, tasks, parameters, outputfile)
Exemplo n.º 2
0
def compute_runtimes(configuration_file, results_directory, outputfile):
    print 'Loading configuration...'
    with open(configuration_file, 'r') as f:
        configuration = yaml.load(f)

    experiment_name = configuration['experiment_name']
    if experiment_name not in EXPERIMENTS:
        raise ValueError('No support for "%s"' % experiment_name)

    stat_func = lambda *args: EXPERIMENTS[experiment_name](*args)

    tasks, parameters = load_config(configuration_file, results_directory)

    stat_func(configuration, tasks, parameters, outputfile)
Exemplo n.º 3
0
def compute_runtimes(configuration_file, results_directory, outputfile):
    print 'Loading configuration...'
    with open(configuration_file, 'r') as f:
        configuration = yaml.load(f)

    experiment_name = configuration['experiment_name']
    if experiment_name not in EXPERIMENTS:
        raise ValueError('No support for "%s"' % experiment_name)

    stat_func = lambda *args: EXPERIMENTS[experiment_name](*args)

    tasks, parameters = load_config(configuration_file, results_directory)

    stat_func(configuration, tasks, parameters, outputfile)
Exemplo n.º 4
0
def run():
    config = server.load_config("swisher.conf")
    current_dir = winstart.find_current_dir()
    log = server.Logger(
        open(os.path.dirname(current_dir) + "\\swisher-log.txt", "a"))
    sys.stdout = log
    sys.stderr = log
    webcontrolx = webcontrol.create_factory(config)
    #mpdplayerx = mpdplayer.create_factory(config)
    spotifyx = spotify.create_factory(config)
    itunesx = itunesplayer.create_factory(config)
    players = [webcontrolx, spotifyx, itunesx]  #mpdplayerx
    #mpdserverx = mpdserver.MpdServer(current_dir)
    #mpdserverx.start()
    instance = server.create_server(current_dir, config, players)
    winstart.run(instance, [])  #[mpdserverx]
Exemplo n.º 5
0
def main():
    parser = argparse.ArgumentParser(description='RFID mpd client')
    parser.add_argument('--list-devices', action="store_true",
                   help='list all present keyboard and rfid reader devices')
    parser.add_argument('--config',  nargs=1, metavar="filename",
                   help='read from config file (same values as these options)')
    parser.add_argument('--grab-device', metavar='name', nargs=1,
                   help='grab and read events from the named device')
    parser.add_argument('--mpd-host', metavar='host', nargs=1,
                   help='the mpd server hostname (localhost)')
    parser.add_argument('--mpd-port', metavar='port', nargs=1,
                   help='the mpd port (6600)')
    parser.add_argument('--http-port', metavar='port', nargs=1,
                   help='the port to run the internal webserver on (3344)')
    parser.add_argument('--cards-file', metavar='filename', nargs=1,
                   help='the file to read and write the cards database to (cards.txt)')
    parser.add_argument('--log', metavar='filename', nargs=1,
                   help='write logs to this file instead of the console and supress web access logs')
    parser.add_argument('--quiet', action="store_true",
                   help='suppress non error logging')
    args = parser.parse_args()
    if args.list_devices:
        cardreader.list_devices()
    else:
        config = {}
        if args.config:
            config = server.load_config(args.config[0])
        if args.grab_device:
            config["grab-device"] = args.grab_device[0]
        if args.mpd_host:
            config["mpd-host"] = args.mpd_host[0]
        if args.mpd_port:
            config["mpd_port"] = args.mpd_port[0]
        if args.http_port:
            config["http-port"] = args.http_port[0]
        if args.cards_file:
            config["cards-file"] = args.cards_file[0]
        if args.log:
            config["log"] = args.log[0]
        run(config)
Exemplo n.º 6
0
def compute_statistics(configuration_file, results_directory, train_or_test, statistic, outputfile):
    bag_or_instance = 'bag'
    print 'Loading configuration...'
    with open(configuration_file, 'r') as f:
        configuration = yaml.load(f)

    experiment_name = configuration['experiment_name']
    if experiment_name not in EXPERIMENTS:
        raise ValueError('No statistics supported for "%s"' % experiment_name)
    if not (bag_or_instance.startswith('b') or bag_or_instance.startswith('i')):
        raise ValueError('Third argument must be "bag" or "instance"')
    if train_or_test not in ('train', 'test'):
        raise ValueError('Third argument must be "train" or "test"')
    if statistic not in STATISTICS:
        raise ValueError('Statistic must be one of: "%s"' % ', '.join(STATISTICS.keys()))

    stat = dict_statistic_wrapper(STATISTICS[statistic], bag_or_instance, train_or_test)
    stat_func = lambda *args: EXPERIMENTS[experiment_name](*args, statistic=stat)

    tasks, parameters = load_config(configuration_file, results_directory)

    stat_func(configuration, tasks, parameters, outputfile)
Exemplo n.º 7
0
def main():
    load_config("server.config.yaml")
    server = Server()
    server.connect_clients()
    server.do_game_loop()
Exemplo n.º 8
0
def runMpd():
    config = server.load_config("swisher.conf")
    current_dir = winstart.find_current_dir()
    instance = server.createMpdController(current_dir, config, [])
    winstart.run(instance)
Exemplo n.º 9
0
#!/usr/bin/env python3

from influxdb import InfluxDBClient
import configparser
import uuid
import random
import datetime
import time
from server import load_config, generate_data, generate_input_influx

config_data = load_config('DATA')
influx_config = load_config('INFLUXDB')
client = InfluxDBClient(host=influx_config['host'], port=influx_config['port'])
client.create_database(influx_config['database'])
measurement_name = influx_config['measurement']

number_of_points = 2500000
numseconds = number_of_points

data = []

base = datetime.datetime.today()
date_list = [base - datetime.timedelta(seconds=x) for x in range(numseconds)]

for date in date_list:
    row = generate_data(config_data, date)
    line = generate_input_influx(row, measurement_name)
    data.append(line)
    print(line)
    print(date)
    print("-----------------------")