--- ea/xml_conv.py 2012/08/31 10:40:38 10 +++ ea/xml_conv.py 2012/10/09 14:42:19 15 @@ -3,7 +3,7 @@ # # Copyright (c) Fundacion Centro Tecnologico de Supercomputacion de Galicia 2012 # -# License GPL Version 3 +# License Apache Software # # The research leading to these results has received funding from # the European Community's Seventh Framework Programme (FP7/2007-2013) @@ -32,15 +32,15 @@ def xml_parse(code): """Input: XML Variable - Ouput: lista con ruta_relativa exp, name, description,status,ruta log """ + Ouput: list with relative URL exp, name, description,status,ruta log """ exp_ref = dict() elements = tree.fromstring(code) for sub in elements.iter(): if(sub.tag == 'managed_experiment'): - #Imprime atributos de ese tag. Devuelve un diccionario + #Print attributes. Returns a dictionary exp_ref['experiment'] = sub.attrib['href'] if(sub.tag == 'name'): - #Imprime el campo correspondiente al tag + #Print the field for this tag exp_ref['name'] = sub.text if(sub.tag == 'description'): exp_ref['descrip'] = sub.text @@ -67,12 +67,11 @@ # "All of the resources have been deployed.\n"] def log_parsing(code, raiz, compute): - """Respuesta del log plain text - se le puede pasar a python directamente como lista. + """Output from log plain text. Error: 1.- Info the experiment 2.- Infor broker experiment - 3.- URI en el broker experiment + 3.- URI broker experiment 4.- Info of deploying network 5.- Resource URI network 6.- Info about deploying storage @@ -80,12 +79,12 @@ 8.- Info about deploying compute 9.- Resource URI computes 10.- Info about experiment status - 11.- 7 lineas con info error enactor + 11.- 7 lines with info error enactor OK: 1.- Creation date of logfile 2.- Info about the experiment - 3.- URI en el broker experiment + 3.- URI broker experiment 4.- Info of deploying network 5.- Resource URI network 6.- Info about deploying storage @@ -113,7 +112,7 @@ log['error']=0 #compute=[] print 'EM reply:', code - #comprobamos antes si hay un error en la respuesta. + # Check errors in the answer. if 'Error' in str(code): print 'Broker api error:', code log['error'] = 1 @@ -142,48 +141,6 @@ return log -#code=""" -# -# 21474 -# 1 -# 1024 -# JSON-COMPUTE-TEST -# small -# RUNNING -# -# -# DISK -# xvda -# -# -# -# 172.18.7.87 -# 02:00:ac:12:07:57 -# -# -# ssh-dss AAAAB3NzaC1kc3MAAACBAPhVbbL4qAcvyuvlVdd3QUQnJzzKL2N92wH33mS10HAzfRF7a40iW31+PT7IBLnPalwg7yRPNcGLfXIrtqBjlVZLynzCwP1JH3Z6diokMjukMbNX/rXe/TeIIzWI7BLJeLXPuXBrm/oW97RN+s8fYetnDHhxclgo8+J27K80Qe5FAAAAFQCweWyZxWYlaUuN8vr+Bxcaj23l1wAAAIEA17Wq9yd0mHpnAympsQZmKUtFiRuLr0OHYmI4XV6+Av+2f2wrvlNTgpr4A2Tr0E1I/utUqkt38dzTU6sOFfau0y5tNkrWu5r33nrmPdCSRAlNybU1yFgFp5CNEG8QKjikXhIrpo35WLy+Y6JuoBtOp3+BDTTsZhMFxIAPyNzu4XYAAACBAKKcf9owhthEpx+9t6a8o8EoCfmcpF/jU2Ml3Ia291cn0MUo798xLXoTOPIxivcA/VJe7EPUEKcVxc0och0e0UuzGT3dUEfVRlfZnERBkdZHWSZT7a+BKESTnV5xBMi2Q2wWQrPbYhXd0+zYg5Zm5/Qcd8Ou3Tu+cFTvKMtDZ1Iq cesga@anzol -# rvalin:t87rgt8sjm23yzcuhwvws -# 1327934238 -# 130 -# a5b4c4ec82c53fbe63b7 -# fr-inria -# 21474 -# JSON-COMPUTE-TEST -# https://api.integration.bonfire.grid5000.fr -# default -# 131.254.204.4 -# /srv/cloud/context /srv/cloud/context/lib /srv/cloud/context/distributions /srv/cloud/context/sites /srv/cloud/context/common /srv/cloud/context/init.sh -# JSON-COMPUTE-TEST-21474 -# PG1ldHJpYz5ib25maXJlLmNvdW50MTBbL3RtcC90ZXN0RmlsZS50eHRdLHdjIC1sICQxIHwgY3V0IC1kIiAiIC1mMTwvbWV0cmljPjxtZXRyaWM+Ym9uZmlyZS5jb3VudDlbL3RtcC90ZXN0RmlsZS50eHRdLHdjIC1sICQxIHwgY3V0IC1kIiAiIC1mMTwvbWV0cmljPg== -# ntp.rennes.grid5000.fr -# 131.254.204.8 -# xvdb -# zabbix-agent -# 172.18.7.87 -# 02:00:ac:12:07:57 -# -# node-1.integration -#""" def xml_compute_parse(code): @@ -193,12 +150,11 @@ for sub in elements.iter(): #print sub if('cpu' in sub.tag): - #Imprime atributos de ese tag. Devuelve un diccionario + #Print attributes #print sub.text compute_info['cpu'] = sub.text if('memory' in sub.tag): - #Imprime el campo correspondiente al tag - #print sub.text + compute_info['mem'] = sub.text if('hostname' in sub.tag): compute_info['hostname'] = sub.text @@ -235,7 +191,7 @@ def mon_par(mon): - """Parseado de la informacion de monitorizacion""" + """Parse monitoring info""" histories=dict() mean=dict() std=dict() @@ -291,13 +247,13 @@ """ def xml_qhost(code): - "Parsea la salida xml del qhost y devuelve los nodos disponibles" + "Parse qhost xml info and returns available nodes" elements = tree.fromstring(code) nodes=0 for sub in elements.iter(): if(sub.tag == 'host'): - #Imprime atributos de ese tag. Devuelve un diccionario + hostname = sub.attrib['name'] if 'global' not in hostname: nodes=nodes+1