def server(outputfile='test.h5', configPath='parameters.yaml'):
    """Server"""
    config = yaml.load(open(configPath))
    descr = yaml.dump(config)
    print descr
    config['descr'] = descr
    sourceTable = readSourcesTable(config["sourcesPath"])
    carbonSources = [elem[0] for elem in sourceTable if elem[1] == 1]
    sources2sig = dict([(row[0], tuple(row[1:]))for row in sourceTable])
    combSources = list(combinatoricalSources(sourceTable, carbonSources))
    gen = generateCombinatoricalMedia(config["uptake"], combSources)
    lp = Metabolism(ImportCplex(config["path2model"]))
    simulationStorage = generateStorageObject(outputfile, lp)
    inputQueue = Queue.Queue(20)
    outputQueue = Queue.Queue(20)
    # gen2 = (config["medium"] = elem for elem in gen)
    gen2 = stub(gen, config)
    t1 = GeneratorInputClient(inputQueue, gen2)
    t1.start()
    time.sleep(1)
    t2 = h5OutputClient(outputQueue, simulationStorage)
    t2.start()
    time.sleep(1)
    s = Server(inputQueue=inputQueue, outputQueue=outputQueue, host="localhost")
    print s
    s.run()
def server(outputfile='test.h5', config='parameters.yaml'):
    """Server"""
    config = readYamlConfig(config)
    descr = yaml.dump(config)
    print descr
    config['descr'] = descr
    randomSimulationsObj = generateRandomMediaObject(**config)
    lp = Metabolism(ImportCplex(config['path']))
    simulationStorage = generateStorageObject(outputfile, lp)
    inputQueue = Queue.Queue(20)
    outputQueue = Queue.Queue(20)
    t1 = configInputClient(inputQueue, config)
    t1.start()
    time.sleep(1)
    t2 = h5OutputClient(outputQueue, simulationStorage)
    t2.start()
    s = Server(inputQueue=inputQueue, outputQueue=outputQueue, host="localhost")
    print s
    s.run()