Exemple #1
0
    port = input("port:")

if csv == 0:
    csv = raw_input("CSV file to output to manager:")

labels = 0;
try:
    csv = open(csv,"r")
    labels = csv.readline()
    labels = labels.split(",")[0:-1]
except Exception as e:
    print "Could not open CSV file for playback. "+str(e)
    csv = 0 

#initialise monitor
m = monitor("NONE",0);
IDs = [address,0,0];
comm = 0;
r = RequestBuilder(m);

INDEX = 0.0
def fakeAnswer(mid,vid,msg):
    global comm,r,IDs,csv,labels,terminate,HEAP,AVAILABLE,THROUGHPUT,INDEX
    if(msg["global"]["action"] == "status"):
        request = r.statusReport(IDs[0],IDs[1]);
        if csv != 0:
            line = csv.readline()
            print "LINE:("+str(len(line))+") "+line
            if len(line) < 3:
                terminate = True;
Exemple #2
0
for i in range(0,len(sys.argv)):
    if sys.argv[i] == "port" and i+1 < len(sys.argv):
        port = int(sys.argv[i+1])
    
    if "config=" in sys.argv[i]:
        cfg = sys.argv[i].split("=");
        if len(cfg) > 1:
            confFile = cfg[1];

#Defaults
pltSvc = PlotService(["heap","footPrint","maxHeapSize"],15027)
pltSvc.doNormalise({"heap":1024*1024.0,"footPrint":1024*1024.0,"maxHeapSize":1024*1024.0,"throughput":1.0});

print "Initialising Registry..."
mon = monitor("MACHINE",pltSvc);
srv = server(mon,port);

if srv.start() == False:
    print "Error starting registry server - "+srv.getError();
else:
    print("Starting ...");
    time.sleep(1);
    
    print "Initialising policy...";
    #run the policy executor
    policy = Policy(mon,4,confFile);

    print "Shutting Down..."
    srv.close();
    mon.close();