''' Created on 05/06/2014 @author: nikolay ''' from __builtin__ import map import sys import time import collections import logging from os.path import os from sys import maxint from autoscale.FANNWrapper import FANNWrapper from math import * fann = FANNWrapper(topology=(1, 250, 2)); for k in range(1, 1000): for i in range(k, 10000, k): expOutput = [log(i * 10), log(i * 10)] rmse = fann.train(n=i, expOutput=expOutput, trainTimes = 1, revert=False, maxRMSE=0.05) print "Training with i = %d, RMSE: %.4f, output=[%.4f, %.4f]" % (i, rmse, expOutput[0], expOutput[1]) for i in range(1, 10000, 100): result = fann.run(i) rmse = fann.rmse(i, result) print "Result: %d, RMSE: %.4f, output=[%.4f, %.4f]" % (i, rmse, result[0], result[1])
declaredCpuCapacity=3, declaredRAMCapacityKB=convertMem(3.75, "GB", "KB"), costPerTimeUnit=0.098) types = [m1Small, m1Medium, m3Medium] types.sort(key=lambda t: t.declaredCpuCapacity) ##== Initialise client, first AS servers and Load Balancers firstAppServer = factory.createVM(readableName="App 1", vmType=m3Medium, address=firstAppServerAddress) serverFarm = factory.createServerFarm(address=loadBalancerAddress) serverFarm.addServers(firstAppServer) ##== fann = FANNWrapper(topology=(inputUnits, hiddenUnits, 2)) # # === #nextAppServer = factory.createVM(readableName="App 2", vmType = t1Micro, address = None) #log.info("------------->" + nextAppServer.address) #serverFarm.addServers(nextAppServer) time.sleep(90) inputMomentum = 0.0 # Sleep between measurments defSleepPeriod = 5 sleepPeriod = defSleepPeriod # Used to determine lrk
##== VM types t1Micro = VMType(code="t1.micro", declaredCpuCapacity=0.5, declaredRAMCapacityKB=convertMem(0.615, "GB", "KB"), costPerTimeUnit=0.02) m1Small = VMType(code="m1.small", declaredCpuCapacity=1, declaredRAMCapacityKB=convertMem(1.7, "GB", "KB"), costPerTimeUnit=0.058) m1Medium = VMType(code="m1.medium", declaredCpuCapacity=2, declaredRAMCapacityKB=convertMem(3.75, "GB", "KB"), costPerTimeUnit=0.117) m3Medium = VMType(code="m3.medium", declaredCpuCapacity=3, declaredRAMCapacityKB=convertMem(3.75, "GB", "KB"), costPerTimeUnit=0.098) types = [m1Small, m1Medium, m3Medium] types.sort(key=lambda t: t.declaredCpuCapacity) ##== Initialise client, first AS servers and Load Balancers firstAppServer = factory.createVM(readableName="App 1", vmType=m3Medium, address=firstAppServerAddress) serverFarm = factory.createServerFarm(address=loadBalancerAddress) serverFarm.addServers(firstAppServer) ##== fann = FANNWrapper(topology=(inputUnits, hiddenUnits, 2)) # # === #nextAppServer = factory.createVM(readableName="App 2", vmType = t1Micro, address = None) #log.info("------------->" + nextAppServer.address) #serverFarm.addServers(nextAppServer) client = factory.createClient(address=clientAddress) workload = Workload(readableName = "Main Workload", client = client) for w in range(0, 94): workload.addRun(loadScale=w*10 + 30, rampUp=60, steadyState=300 , rampDown=10) workload.start() time.sleep(90)