--- ea/xml_conv.py 2012/10/08 09:46:28 14 +++ ea/xml_conv.py 2012/10/09 14:42:19 15 @@ -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 @@ -151,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 @@ -193,7 +191,7 @@ def mon_par(mon): - """Parseado de la informacion de monitorizacion""" + """Parse monitoring info""" histories=dict() mean=dict() std=dict() @@ -249,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