[bonfiredemokit] Annotation of /ea/xml_conv.py
Annotation of /ea/xml_conv.py
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
(as text)
1 : |
agomez |
1 |
'''
|
2 : |
|
|
Created on 20/01/2012
|
3 : |
|
|
|
4 : |
|
|
@author: R. Valin
|
5 : |
|
|
'''
|
6 : |
|
|
import xml.etree.ElementTree as tree
|
7 : |
|
|
#import simplejson
|
8 : |
|
|
|
9 : |
|
|
#<?xml version="1.0" encoding="UTF-8"?>\
|
10 : |
|
|
#code="""<?xml version="1.0" encoding="UTF-8"?>\
|
11 : |
|
|
# <managed_experiment href="/managed_experiments/13">\
|
12 : |
|
|
# <name>My Experiment</name>\
|
13 : |
|
|
# <description>Experiment description</description>\
|
14 : |
|
|
# <status>not_implemented</status>\
|
15 : |
|
|
# <link rel="experiment" href=""/>\
|
16 : |
|
|
# <link rel="log" href="/managed_experiments/13/log"/>\
|
17 : |
|
|
# </managed_experiment>"""
|
18 : |
|
|
|
19 : |
|
|
|
20 : |
|
|
def xml_parse(code):
|
21 : |
|
|
"""Input: XML Variable
|
22 : |
|
|
Ouput: lista con ruta_relativa exp, name, description,status,ruta log """
|
23 : |
|
|
exp_ref = dict()
|
24 : |
|
|
elements = tree.fromstring(code)
|
25 : |
|
|
for sub in elements.iter():
|
26 : |
|
|
if(sub.tag == 'managed_experiment'):
|
27 : |
|
|
#Imprime atributos de ese tag. Devuelve un diccionario
|
28 : |
|
|
exp_ref['experiment'] = sub.attrib['href']
|
29 : |
|
|
if(sub.tag == 'name'):
|
30 : |
|
|
#Imprime el campo correspondiente al tag
|
31 : |
|
|
exp_ref['name'] = sub.text
|
32 : |
|
|
if(sub.tag == 'description'):
|
33 : |
|
|
exp_ref['descrip'] = sub.text
|
34 : |
|
|
if(sub.tag == 'status'):
|
35 : |
|
|
exp_ref['status'] = sub.text
|
36 : |
|
|
if(sub.tag == 'link' and 'log' in sub.attrib['href']):
|
37 : |
|
|
exp_ref['log'] = sub.attrib['href']
|
38 : |
|
|
#exp=[exp_ref,exp_name,descrip,status,log]
|
39 : |
|
|
return exp_ref
|
40 : |
|
|
|
41 : |
|
|
#exp=xml_parse(code)
|
42 : |
|
|
#print(exp)
|
43 : |
|
|
#raiz='https://api.integration.bonfire.grid5000.fr'
|
44 : |
|
|
#code=["# Logfile created on 2012-02-01 09:49:45 +0100 by logger.rb/25413\n",
|
45 : |
|
|
# "Creating an experiment called My Experiment with user id rvalin.\n",
|
46 : |
|
|
# "Created broker experiment #<Restfully::Resource:0x00000009283df0>\n",
|
47 : |
|
|
# "Broker experiment URI is: https://api.integration.bonfire.grid5000.fr/experiments/64\n",
|
48 : |
|
|
# "Deploying network BonFIRE WAN to fr-inria.\n",
|
49 : |
|
|
# "Resource uri is http://localhost:8000/locations/fr-inria/networks/4\n",
|
50 : |
|
|
# "Deploying storage BonFIRE Debian Squeeze v3 to fr-inria.\n",
|
51 : |
|
|
# "Resource uri is http://localhost:8000/locations/fr-inria/storages/3\n",
|
52 : |
|
|
# "Deploying compute JSON-COMPUTE-TEST to fr-inria.\n",
|
53 : |
|
|
# "Resource uri is http://localhost:8000/locations/fr-inria/computes/21500\n",
|
54 : |
|
|
# "All of the resources have been deployed.\n"]
|
55 : |
|
|
|
56 : |
|
|
def log_parsing(code, raiz, compute):
|
57 : |
|
|
"""Respuesta del log plain text
|
58 : |
|
|
se le puede pasar a python directamente como lista.
|
59 : |
|
|
Error:
|
60 : |
|
|
1.- Info the experiment
|
61 : |
|
|
2.- Infor broker experiment
|
62 : |
|
|
3.- URI en el broker experiment
|
63 : |
|
|
4.- Info of deploying network
|
64 : |
|
|
5.- Resource URI network
|
65 : |
|
|
6.- Info about deploying storage
|
66 : |
|
|
7.- Resource URI storage
|
67 : |
|
|
8.- Info about deploying compute
|
68 : |
|
|
9.- Resource URI computes
|
69 : |
|
|
10.- Info about experiment status
|
70 : |
|
|
11.- 7 lineas con info error enactor
|
71 : |
|
|
|
72 : |
|
|
OK:
|
73 : |
|
|
1.- Creation date of logfile
|
74 : |
|
|
2.- Info about the experiment
|
75 : |
|
|
3.- URI en el broker experiment
|
76 : |
|
|
4.- Info of deploying network
|
77 : |
|
|
5.- Resource URI network
|
78 : |
|
|
6.- Info about deploying storage
|
79 : |
|
|
7.- Resource URI storage
|
80 : |
|
|
8.- Info about deploying compute
|
81 : |
|
|
9.- Resource URI computes
|
82 : |
|
|
10.- Info about experiment status
|
83 : |
|
|
"""
|
84 : |
|
|
|
85 : |
|
|
#["# Logfile created on 2012-02-22 16:17:24 +0000 by logger.rb/25413\n",
|
86 : |
|
|
#"Creating an experiment called My Experiment with user id rvalin.\n",
|
87 : |
|
|
#"Created broker experiment #<Restfully::Resource:0x0000000c059590>\n",
|
88 : |
|
|
#"Broker experiment URI is: https://api.bonfire-project.eu/experiments/502\n",
|
89 : |
|
|
#"Deploying network BonFIRE WAN to fr-inria.\n",
|
90 : |
|
|
#"location is {\"name\"=>\"fr-inria\", \"url\"=>\"https://frontend.bonfire.grid5000.fr:443\"}\n",
|
91 : |
|
|
#"Resource uri is http://localhost:8000/locations/fr-inria/networks/0\n",
|
92 : |
|
|
#"Deploying storage BonFIRE Debian Squeeze v3 to fr-inria.\n",
|
93 : |
|
|
#"Resource uri is http://localhost:8000/locations/fr-inria/storages/1\n",
|
94 : |
|
|
#"Deploying compute JSON-COMPUTE-TEST to fr-inria.\n",
|
95 : |
|
|
#"Resource uri is http://localhost:8000/locations/fr-inria/computes/714\n",
|
96 : |
|
|
#"All of the resources have been deployed.\n"]
|
97 : |
|
|
|
98 : |
|
|
log = dict()
|
99 : |
|
|
log['deployed'] = ''
|
100 : |
|
|
log['error']=0
|
101 : |
|
|
#compute=[]
|
102 : |
|
|
print 'EM reply:', code
|
103 : |
|
|
#comprobamos antes si hay un error en la respuesta.
|
104 : |
|
|
if 'Error' in str(code):
|
105 : |
|
|
print 'Broker api error:', code
|
106 : |
|
|
log['error'] = 1
|
107 : |
|
|
else:
|
108 : |
|
|
for i in code:
|
109 : |
|
|
print (i)
|
110 : |
|
|
#if 'Error' in i:
|
111 : |
|
|
# print 'Broker api error:', code
|
112 : |
|
|
# log['error'] = 1
|
113 : |
|
|
if 'Logfile created' in i:
|
114 : |
|
|
log['Logfile'] = i.split('created on')[1].split('by')[0]
|
115 : |
|
|
if 'Broker experiment URI is:' in i:
|
116 : |
|
|
log['broker'] = i.split('Broker experiment URI is:')[1].split('\n')[0].strip()
|
117 : |
|
|
if 'storages' in i:
|
118 : |
|
|
log['storages'] = i.split('resource uri is')[1].split('\n')[0].strip().replace('http://localhost:8000', raiz)
|
119 : |
|
|
if 'computes' in i:
|
120 : |
|
|
#print 'compute:', compute
|
121 : |
|
|
if (i.split('resource uri is')[1].split('\n')[0].strip().replace('http://localhost:8000', raiz) not in compute):
|
122 : |
|
|
compute.append(i.split('resource uri is')[1].split('\n')[0].strip().replace('http://localhost:8000', raiz))
|
123 : |
|
|
log['computes'] = compute
|
124 : |
|
|
if 'networks' in i:
|
125 : |
|
|
print i.split('resource uri is')
|
126 : |
|
|
log['networks'] = i.split('resource uri is')[1].split('\n')[0].strip().replace('http://localhost:8000', raiz)
|
127 : |
|
|
if 'All of the resources have been deployed' in i:
|
128 : |
|
|
log['deployed'] = i
|
129 : |
|
|
|
130 : |
|
|
return log
|
131 : |
|
|
|
132 : |
|
|
#code="""<?xml version="1.0" encoding="UTF-8"?>
|
133 : |
|
|
#<compute xmlns="http://api.bonfire-project.eu/doc/schemas/occi" href="/locations/fr-inria/computes/21474">
|
134 : |
|
|
# <id>21474</id>
|
135 : |
|
|
# <cpu>1</cpu>
|
136 : |
|
|
# <memory>1024</memory>
|
137 : |
|
|
# <name>JSON-COMPUTE-TEST</name>
|
138 : |
|
|
# <instance_type>small</instance_type>
|
139 : |
|
|
# <state>RUNNING</state>
|
140 : |
|
|
# <disk id="0">
|
141 : |
|
|
# <storage href="/locations/fr-inria/storages/3" name="BonFIRE Debian Squeeze v3"/>
|
142 : |
|
|
# <type>DISK</type>
|
143 : |
|
|
# <target>xvda</target>
|
144 : |
|
|
# </disk>
|
145 : |
|
|
# <nic>
|
146 : |
|
|
# <network href="/locations/fr-inria/networks/4" name="BonFIRE WAN"/>
|
147 : |
|
|
# <ip>172.18.7.87</ip>
|
148 : |
|
|
# <mac>02:00:ac:12:07:57</mac>
|
149 : |
|
|
# </nic>
|
150 : |
|
|
# <context>
|
151 : |
|
|
# <authorized_keys>ssh-dss AAAAB3NzaC1kc3MAAACBAPhVbbL4qAcvyuvlVdd3QUQnJzzKL2N92wH33mS10HAzfRF7a40iW31+PT7IBLnPalwg7yRPNcGLfXIrtqBjlVZLynzCwP1JH3Z6diokMjukMbNX/rXe/TeIIzWI7BLJeLXPuXBrm/oW97RN+s8fYetnDHhxclgo8+J27K80Qe5FAAAAFQCweWyZxWYlaUuN8vr+Bxcaj23l1wAAAIEA17Wq9yd0mHpnAympsQZmKUtFiRuLr0OHYmI4XV6+Av+2f2wrvlNTgpr4A2Tr0E1I/utUqkt38dzTU6sOFfau0y5tNkrWu5r33nrmPdCSRAlNybU1yFgFp5CNEG8QKjikXhIrpo35WLy+Y6JuoBtOp3+BDTTsZhMFxIAPyNzu4XYAAACBAKKcf9owhthEpx+9t6a8o8EoCfmcpF/jU2Ml3Ia291cn0MUo798xLXoTOPIxivcA/VJe7EPUEKcVxc0och0e0UuzGT3dUEfVRlfZnERBkdZHWSZT7a+BKESTnV5xBMi2Q2wWQrPbYhXd0+zYg5Zm5/Qcd8Ou3Tu+cFTvKMtDZ1Iq cesga@anzol</authorized_keys>
|
152 : |
|
|
# <bonfire_credentials>rvalin:t87rgt8sjm23yzcuhwvws</bonfire_credentials>
|
153 : |
|
|
# <bonfire_experiment_expiration_date>1327934238</bonfire_experiment_expiration_date>
|
154 : |
|
|
# <bonfire_experiment_id>130</bonfire_experiment_id>
|
155 : |
|
|
# <bonfire_experiment_routing_key>a5b4c4ec82c53fbe63b7</bonfire_experiment_routing_key>
|
156 : |
|
|
# <bonfire_provider>fr-inria</bonfire_provider>
|
157 : |
|
|
# <bonfire_resource_id>21474</bonfire_resource_id>
|
158 : |
|
|
# <bonfire_resource_name>JSON-COMPUTE-TEST</bonfire_resource_name>
|
159 : |
|
|
# <bonfire_uri>https://api.integration.bonfire.grid5000.fr</bonfire_uri>
|
160 : |
|
|
# <cluster>default</cluster>
|
161 : |
|
|
# <dns_servers>131.254.204.4</dns_servers>
|
162 : |
|
|
# <files>/srv/cloud/context /srv/cloud/context/lib /srv/cloud/context/distributions /srv/cloud/context/sites /srv/cloud/context/common /srv/cloud/context/init.sh</files>
|
163 : |
|
|
# <hostname>JSON-COMPUTE-TEST-21474</hostname>
|
164 : |
|
|
# <metrics>PG1ldHJpYz5ib25maXJlLmNvdW50MTBbL3RtcC90ZXN0RmlsZS50eHRdLHdjIC1sICQxIHwgY3V0IC1kIiAiIC1mMTwvbWV0cmljPjxtZXRyaWM+Ym9uZmlyZS5jb3VudDlbL3RtcC90ZXN0RmlsZS50eHRdLHdjIC1sICQxIHwgY3V0IC1kIiAiIC1mMTwvbWV0cmljPg==</metrics>
|
165 : |
|
|
# <ntp_servers>ntp.rennes.grid5000.fr</ntp_servers>
|
166 : |
|
|
# <public_gateway>131.254.204.8</public_gateway>
|
167 : |
|
|
# <target>xvdb</target>
|
168 : |
|
|
# <usage>zabbix-agent</usage>
|
169 : |
|
|
# <wan_ip>172.18.7.87</wan_ip>
|
170 : |
|
|
# <wan_mac>02:00:ac:12:07:57</wan_mac>
|
171 : |
|
|
# </context>
|
172 : |
|
|
# <host>node-1.integration</host>
|
173 : |
|
|
#<link rel="experiment" href="/experiments/130" type="application/vnd.bonfire+xml"/></compute>"""
|
174 : |
|
|
|
175 : |
|
|
|
176 : |
|
|
def xml_compute_parse(code):
|
177 : |
|
|
compute_info = dict()
|
178 : |
|
|
#print code
|
179 : |
|
|
elements = tree.fromstring(code)
|
180 : |
|
|
for sub in elements.iter():
|
181 : |
|
|
#print sub
|
182 : |
|
|
if('cpu' in sub.tag):
|
183 : |
|
|
#Imprime atributos de ese tag. Devuelve un diccionario
|
184 : |
|
|
#print sub.text
|
185 : |
|
|
compute_info['cpu'] = sub.text
|
186 : |
|
|
if('memory' in sub.tag):
|
187 : |
|
|
#Imprime el campo correspondiente al tag
|
188 : |
|
|
#print sub.text
|
189 : |
|
|
compute_info['mem'] = sub.text
|
190 : |
|
|
if('hostname' in sub.tag):
|
191 : |
|
|
compute_info['hostname'] = sub.text
|
192 : |
|
|
if('instance' in sub.tag):
|
193 : |
|
|
compute_info['instance'] = sub.text
|
194 : |
|
|
if('state' in sub.tag):
|
195 : |
|
|
compute_info['state'] = sub.text
|
196 : |
|
|
if('ip' in sub.tag):
|
197 : |
|
|
compute_info['ip'] = sub.text
|
198 : |
|
|
if('state' in sub.tag):
|
199 : |
|
|
compute_info['state'] = sub.text
|
200 : |
|
|
if('name' in sub.tag and 'hostname' not in sub.tag):
|
201 : |
|
|
compute_info['name'] = sub.text
|
202 : |
|
|
if('disk' in sub.tag):
|
203 : |
|
|
for sub1 in sub.iter():
|
204 : |
|
|
if('storage' in sub1.tag):
|
205 : |
|
|
compute_info['disk_ref'] = sub1.attrib['href']
|
206 : |
|
|
if('nic' in sub.tag):
|
207 : |
|
|
for sub1 in sub.iter():
|
208 : |
|
|
if('network' in sub1.tag):
|
209 : |
|
|
compute_info['net_ref'] = sub1.attrib['href']
|
210 : |
|
|
compute_info['loc_ref'] = sub1.attrib['href'].split('/networks')[0]
|
211 : |
|
|
|
212 : |
|
|
#exp=[exp_ref,exp_name,descrip,status,log]
|
213 : |
|
|
return compute_info
|
214 : |
|
|
|
215 : |
|
|
#print(log_parsing(code,raiz))
|
216 : |
|
|
#data=xml_compute_parse(code)
|
217 : |
|
|
#print(data)
|
218 : |
|
|
|
219 : |
|
|
#print (xml_compute_parse(code))
|
220 : |
|
|
|
221 : |
|
|
mon=(2, {'compute-5-11.local': {'std': 0.27531010070510958, 'median': 65.746219592373436, 'rates': [66.24710168930109, 65.955809607562927, 65.67425569176882, 65.746219592373436, 66.02839220864972, 65.876152832674578, 65.71741511500548, 65.56660474265108, 65.905096660808439, 65.040650406504071, 65.595277140045908, 65.739016106058941, 65.868920847513451], 'histories': 780000, 'mean': 65.766224049301371}, 'compute-4-11.local': {'std': 0.16944217389085148, 'median': 65.366604651039125, 'rates': [65.22448092183933, 65.267051017078217, 65.437888537463195, 65.203216692023474, 65.345240688303193, 65.387968613775058, 65.588106689986887, 65.588106689986887, 65.104166666666671, 65.281253400065282, 65.631152920586302, 65.44502617801048, 65.245759025663332, 65.075921908893704, 65.530799475753597, 65.580937807410649, 65.473592317765167, 65.22448092183933], 'histories': 1080000, 'mean': 65.36861947072839}, 'compute-5-16.local': {'std': 0.27197573731279834, 'median': 65.656298956188067, 'rates': [65.238664781994132, 66.013862911211362, 65.316786414108421, 65.631152920586302, 65.281253400065282, 65.767839526471562, 65.905096660808439, 65.818341377797282, 65.402223675604972, 65.681444991789817, 65.309676717100245, 65.516488316226258, 66.013862911211362, 65.890621568196792], 'histories': 840000, 'mean': 65.627665440940888}, 'compute-5-10.local': {'std': 0.28231155887623044, 'median': 65.934065934065927, 'rates': [65.941312232113418, 65.509335080248931, 66.40106241699867, 65.919578114700059, 65.934065934065927], 'histories': 300000, 'mean': 65.941070755625404}, 'compute-5-14.local': {'std': 0.13694861707773998, 'median': 65.952189646527188, 'rates': [65.934065934065927, 65.667067965415342, 66.021126760563391, 65.970313358988449], 'histories': 240000, 'mean': 65.898143504758281}, 'compute-5-13.local': {'std': 0.16180416050605789, 'median': 65.970313358988449, 'rates': [65.919578114700059, 65.970313358988449, 66.239788032678305, 65.760631302060503, 66.093853271645742], 'histories': 300000, 'mean': 65.996832816014617}, 'compute-4-4.local': {'std': 0.4999064894794748, 'median': 65.256426634870621, 'rates': [65.416484954208457, 65.217391304347828, 65.054754418302068, 63.897763578274763, 65.2954619653934, 64.977257959714095, 65.487884741322858, 65.395095367847418, 65.941312232113418, 65.09710317890854], 'histories': 600000, 'mean': 65.178050970043287}, 'compute-4-51.local': {'std': 13.529048653730063, 'median': 62.389518560881768, 'rates': [65.082980800520659, 34.205575508807939, 34.42143307899719, 65.366597668591353, 65.181966322650737, 46.667185190946562, 65.395095367847418, 38.178164768921633, 62.389518560881768], 'histories': 525600.0, 'mean': 52.987613029796144}, 'compute-4-21.local': {'std': 0.988076603974963, 'median': 64.766839378238345, 'rates': [63.257775434897205, 63.492063492063494, 64.766839378238345, 65.203216692023474, 65.825562260010969], 'histories': 300000, 'mean': 64.509091451446693}, 'compute-4-13.local': {'std': 0.14702779113458259, 'median': 65.832804540436186, 'rates': [65.955809607562927, 65.897858319604609, 65.724613867893524, 65.868920847513451, 65.876152832674578, 65.796688233358921, 65.480737749645314, 65.645514223194752], 'histories': 480000, 'mean': 65.780786960181004}, 'compute-4-19.local': {'std': 0.19474649681107825, 'median': 65.926822024383, 'rates': [66.166740185266875, 66.042927903137041, 66.181336863004631, 66.144857237349797, 66.064743448579605, 65.876152832674578, 66.357000663570005, 65.767839526471562, 65.883386406061263, 65.963060686015822, 65.934065934065927, 66.122988759091911, 65.941312232113418, 65.832784726793946, 65.883386406061263, 65.782260717026645, 65.7102179388895, 65.919578114700059, 65.825562260010969, 66.159444260668209, 65.516488316226258, 65.659881812212745], 'histories': 1320000, 'mean': 65.942546237726887}, 'compute-4-10.local': {'std': 0.47128705444395269, 'median': 65.423624926807719, 'rates': [64.102564102564102, 65.402223675604972, 65.81112207963146, 64.329366355741399, 65.167807103290968, 65.245759025663332, 65.545116888791782, 65.602449158101905, 66.050198150594454, 65.245759025663332, 65.44502617801048, 65.631152920586302, 65.868920847513451, 64.970221981591777, 65.695828314902002, 65.22448092183933, 65.588106689986887, 64.871878040869291, 65.552277941658474, 65.941312232113418, 64.808813998703826, 65.267051017078217, 65.245759025663332, 65.847234416154521], 'histories': 1440000, 'mean': 65.352517920513293}, 'compute-4-14.local': {'std': 0.29359497406758922, 'median': 65.955810404559912, 'rates': [65.402223675604972, 65.963060686015822, 66.393714728339049, 66.152149944873202, 65.948560123103988, 65.919578114700059, 65.530799475753597, 66.144857237349797, 65.71741511500548, 65.502183406113531, 65.580937807410649, 66.13027664499063, 66.195939982347753, 66.021126760563391], 'histories': 840000, 'mean': 65.900201693012278}, 'compute-5-21.local': {'std': 0.50364664382236057, 'median': 65.473592317765167, 'rates': [65.897858319604609, 65.516488316226258, 65.366597668591353, 65.602449158101905, 65.452165375804512, 65.502183406113531, 64.899945916711729, 64.027318322484263, 64.710957722174285, 65.760631302060503, 66.101134736146307, 65.86169045005488, 65.473592317765167, 65.210303227910003, 65.466448445171849], 'histories': 900000, 'mean': 65.389984312328068}, 'compute-5-9.local': {'std': 0.18047892481052522, 'median': 66.061274896414901, 'rates': [66.181336863004631, 66.166740185266875, 65.739016106058941, 65.955809607562927], 'histories': 240000, 'mean': 66.010725690473336}, 'compute-4-7.local': {'std': 0.41586918049818788, 'median': 65.623974625396485, 'rates': [65.203216692023474, 66.101134736146307, 65.623974625396485, 66.064743448579605, 66.195939982347753, 65.338124795818359, 65.231572080887148, 64.991334488734836, 65.63833278634722], 'histories': 540000, 'mean': 65.598708181809016}, 'compute-5-22.local': {'std': 0.47582183670229977, 'median': 65.391533544242492, 'rates': [65.380843412880026, 65.775049331286993, 64.45375443119562, 66.03565925599824, 64.488392089423911, 65.63833278634722, 65.189048239895698, 65.480737749645314, 64.822817631806387, 65.167807103290968, 65.416484954208457, 65.402223675604972, 65.409353537555873, 65.437888537463195, 65.796688233358921, 64.267352185089976, 64.495324089003546, 64.794816414686821, 65.609622744669224, 65.63833278634722, 65.061808718282364, 65.281253400065282], 'histories': 1320000, 'mean': 65.22925415036849}, 'compute-4-5.local': {'std': 0.20054348556932716, 'median': 65.005417118093177, 'rates': [65.423617926071316, 65.005417118093177, 64.991334488734836], 'histories': 180000, 'mean': 65.1401231776331}, 'compute-4-6.local': {'std': 0.53422239710398001, 'median': 64.822817631806387, 'rates': [65.153654034097087, 64.822817631806387, 64.977257959714095, 64.970221981591777, 64.047822374039285, 64.164260506897662, 65.2954619653934, 65.09710317890854, 64.857853205058916, 64.027318322484263, 64.613396510876584, 65.22448092183933, 65.352358130922553, 64.935064935064929, 65.416484954208457, 65.075921908893704, 64.530006453000652, 64.822817631806387, 63.986349578756531, 64.0, 63.959066197633511, 63.478628861616585, 64.745872450631268], 'histories': 1380000, 'mean': 64.676270421532251}, 'compute-4-53.local': {'std': 0.18842175802978689, 'median': 65.955810404559912, 'rates': [66.013862911211362, 66.291017567119653, 65.71741511500548, 65.81112207963146, 65.963060686015822, 66.115702479338836, 65.659881812212745, 65.948560123103988, 65.530799475753597, 66.101134736146307, 66.050198150594454, 65.941312232113418, 66.013862911211362, 65.695828314902002, 65.631152920586302, 65.905096660808439, 66.152149944873202, 66.006600660066013, 65.926821228436438, 66.101134736146307, 65.847234416154521, 66.101134736146307], 'histories': 1320000, 'mean': 65.932958358980827}, 'compute-6-6.local': {'std': 0.52897981502333113, 'median': 64.66911047317916, 'rates': [64.899945916711729, 64.836827317916573, 65.309676717100245, 65.054754418302068, 64.488392089423911, 64.467605028473187, 64.7878198898607, 64.391500321957508, 64.01365624666596, 64.047822374039285, 63.271116735210377, 65.259952142701763, 64.006827394922126, 65.480737749645314, 64.815815058874364, 64.676080629513848, 64.405324173465004, 64.662140316844486], 'histories': 1080000, 'mean': 64.604221917868244}, 'compute-5-8.local': {'std': 0.36226465552055642, 'median': 65.160749013185821, 'rates': [65.44502617801048, 65.402223675604972, 65.061808718282364, 65.409353537555873, 65.033600693691739, 65.588106689986887, 65.061808718282364, 65.912336592332196, 65.125366330185614, 65.616797900262469, 64.991334488734836, 65.516488316226258, 64.843834432076093, 64.752859917979706, 65.452165375804512, 65.782260717026645, 64.571674558760222, 65.423617926071316, 65.196131696186029, 65.111231687466088, 64.495324089003546, 65.040650406504071], 'histories': 1320000, 'mean': 65.219727393001548}, 'compute-6-1.local': {'std': 0.12211793319188853, 'median': 64.871878040869291, 'rates': [64.942093300140712, 64.65517241379311, 64.871878040869291], 'histories': 180000, 'mean': 64.823047918267704}, 'compute-4-17.local': {'std': 0.41555135853915642, 'median': 65.387981039195722, 'rates': [64.808813998703826, 64.564726137953301, 65.416484954208457, 65.55944055944056, 65.80390436499232, 65.912336592332196, 65.7102179388895, 65.359477124183002, 66.02839220864972, 65.153654034097087, 65.338124795818359, 65.267051017078217], 'histories': 720000, 'mean': 65.410218643862208}, 'compute-6-2.local': {'std': 0.21700550679603481, 'median': 64.292187053143749, 'rates': [64.509192559939791, 64.075181546347721], 'histories': 120000, 'mean': 64.292187053143749}, 'compute-5-15.local': {'std': 0.16698645963038358, 'median': 65.876152832674578, 'rates': [65.753424657534254, 65.760631302060503, 66.217856748703227, 66.02839220864972, 65.883386406061263, 65.999340006599937, 66.101134736146307, 65.545116888791782, 65.775049331286993, 65.847234416154521, 65.955809607562927, 65.876152832674578, 65.703022339027598, 66.03565925599824, 65.818341377797282], 'histories': 900000, 'mean': 65.886703474336613}, 'compute-4-8.local': {'std': 0.21079481164405181, 'median': 65.047701647875115, 'rates': [65.047701647875115, 64.683053040103488, 65.181966322650737], 'histories': 180000, 'mean': 64.970907003543118}, 'compute-5-6.local': {'std': 0.20221498168441351, 'median': 65.919642565186621, 'rates': [65.984823490597165, 65.85446163977609, 65.999340006599937, 66.305669134711025, 65.78947368421052, 66.2763724732133, 65.840008778667837, 65.731814198071874], 'histories': 480000, 'mean': 65.972745425730963}, 'compute-5-17.local': {'std': 0.3690895992706984, 'median': 65.595296740013424, 'rates': [65.631152920586302, 65.55944055944056, 65.181966322650737, 65.86169045005488, 66.115702479338836, 65.040650406504071], 'histories': 360000, 'mean': 65.565100523095893}, 'compute-4-16.local': {'std': 0.28050622424435356, 'median': 65.380844189214827, 'rates': [65.181966322650737, 65.80390436499232, 65.63833278634722, 65.146579804560261, 65.530799475753597, 65.196131696186029, 65.373719764654609, 65.688635865995181, 65.487884741322858, 64.998375040623984, 64.963187527067987, 65.090041223692779, 65.387968613775058, 65.659881812212745, 65.832784726793946, 65.118298241805945], 'histories': 960000, 'mean': 65.381155750527199}, 'compute-4-24.local': {'std': 0.3410502970467485, 'median': 65.252854812398041, 'rates': [64.516129032258064, 65.281253400065282, 65.160729800173769, 65.2954619653934, 65.595277140045908, 65.573770491803273, 65.160729800173769, 64.398411505849523, 65.395095367847418, 65.573770491803273, 65.090041223692779, 65.252854812398041, 64.857853205058916, 65.331010452961678, 65.167807103290968], 'histories': 900000, 'mean': 65.176679719521076}, 'compute-6-4.local': {'std': 2.2464996287703856, 'median': 63.687506634115273, 'rates': [63.761955366631241, 57.498802108289411, 63.626723223753977, 63.728093467870423, 62.978902067807283, 64.2811227769445, 64.523066996451234, 63.599745601017595, 64.377682403433482, 64.095716269629307, 63.498782939993653, 57.915057915057915, 63.687506634115273], 'histories': 780000, 'mean': 62.890242905461179}, 'compute-5-5.local': {'std': 0.18125141922743435, 'median': 65.785867200618583, 'rates': [65.825562260010969, 65.595277140045908, 65.876152832674578, 65.78947368421052, 65.919578114700059, 65.80390436499232, 65.281253400065282, 65.602449158101905, 65.588106689986887, 65.782260717026645], 'histories': 600000, 'mean': 65.706401836181527}, 'compute-5-18.local': {'std': 0.24749922890406173, 'median': 64.14029458390425, 'rates': [64.343163538873995, 64.267352185089976, 64.191719268214399, 64.088869899594101, 63.606487861761906, 64.034151547492002, 64.253587491968304, 63.843370929985106, 64.46067898581866, 63.877355477483235], 'histories': 600000, 'mean': 64.096673718628168}, 'compute-4-9.local': {'std': 2.2133047544010083, 'median': 62.08159451692346, 'rates': [59.868289762522451, 64.294899271324468], 'histories': 120000, 'mean': 62.08159451692346}, 'compute-4-3.local': {'std': 0.19628699359767415, 'median': 66.108417805200531, 'rates': [65.890621568196792, 66.108417805200531, 66.166740185266875, 66.423115244104949, 66.072018500165171, 66.386368665633995, 65.941312232113418, 66.298342541436469, 66.02839220864972, 66.174037719201493, 65.760631302060503], 'histories': 660000, 'mean': 66.113636179275446}, 'compute-4-12.local': {'std': 0.39311214972530534, 'median': 64.942105473106835, 'rates': [64.669109721922837, 65.373719764654609, 65.217391304347828, 64.061499039077518, 64.398411505849523, 65.316786414108421, 64.745872450631268, 64.599483204134373, 65.026552508941151, 64.412238325281805, 65.588106689986887, 64.780824875836743, 64.970221981591777, 65.580937807410649, 64.815815058874364, 65.01246072163832, 64.578624475298668, 65.2954619653934, 65.005417118093177, 64.913988964621879, 64.426071083431765, 65.132435953104647], 'histories': 1320000, 'mean': 64.905519587919628}, 'compute-4-23.local': {'std': 0.25822084068916706, 'median': 64.878892733564015, 'rates': [64.45375443119562, 64.913988964621879, 64.3707756678468, 64.86486486486487, 64.899945916711729, 65.160729800173769, 64.86486486486487, 64.71793765505339, 64.878892733564015, 65.118298241805945, 64.850843060959789, 65.068864548313627, 65.061808718282364, 64.906966681090438, 64.274236743438678], 'histories': 900000, 'mean': 64.827118192852524}, 'cluster': {'std': 2.5784737273574958, 'median': 65.402223675604972, 'rates': [66.24710168930109, 65.955809607562927, 65.67425569176882, 65.746219592373436, 66.02839220864972, 65.876152832674578, 65.71741511500548, 65.56660474265108, 65.905096660808439, 65.040650406504071, 65.595277140045908, 65.739016106058941, 65.868920847513451, 65.22448092183933, 65.267051017078217, 65.437888537463195, 65.203216692023474, 65.345240688303193, 65.387968613775058, 65.588106689986887, 65.588106689986887, 65.104166666666671, 65.281253400065282, 65.631152920586302, 65.44502617801048, 65.245759025663332, 65.075921908893704, 65.530799475753597, 65.580937807410649, 65.473592317765167, 65.22448092183933, 65.238664781994132, 66.013862911211362, 65.316786414108421, 65.631152920586302, 65.281253400065282, 65.767839526471562, 65.905096660808439, 65.818341377797282, 65.402223675604972, 65.681444991789817, 65.309676717100245, 65.516488316226258, 66.013862911211362, 65.890621568196792, 65.941312232113418, 65.509335080248931, 66.40106241699867, 65.919578114700059, 65.934065934065927, 65.934065934065927, 65.667067965415342, 66.021126760563391, 65.970313358988449, 65.919578114700059, 65.970313358988449, 66.239788032678305, 65.760631302060503, 66.093853271645742, 65.416484954208457, 65.217391304347828, 65.054754418302068, 63.897763578274763, 65.2954619653934, 64.977257959714095, 65.487884741322858, 65.395095367847418, 65.941312232113418, 65.09710317890854, 65.082980800520659, 34.205575508807939, 34.42143307899719, 65.366597668591353, 65.181966322650737, 46.667185190946562, 65.395095367847418, 38.178164768921633, 62.389518560881768, 63.257775434897205, 63.492063492063494, 64.766839378238345, 65.203216692023474, 65.825562260010969, 65.955809607562927, 65.897858319604609, 65.724613867893524, 65.868920847513451, 65.876152832674578, 65.796688233358921, 65.480737749645314, 65.645514223194752, 66.166740185266875, 66.042927903137041, 66.181336863004631, 66.144857237349797, 66.064743448579605, 65.876152832674578, 66.357000663570005, 65.767839526471562, 65.883386406061263, 65.963060686015822, 65.934065934065927, 66.122988759091911, 65.941312232113418, 65.832784726793946, 65.883386406061263, 65.782260717026645, 65.7102179388895, 65.919578114700059, 65.825562260010969, 66.159444260668209, 65.516488316226258, 65.659881812212745, 64.102564102564102, 65.402223675604972, 65.81112207963146, 64.329366355741399, 65.167807103290968, 65.245759025663332, 65.545116888791782, 65.602449158101905, 66.050198150594454, 65.245759025663332, 65.44502617801048, 65.631152920586302, 65.868920847513451, 64.970221981591777, 65.695828314902002, 65.22448092183933, 65.588106689986887, 64.871878040869291, 65.552277941658474, 65.941312232113418, 64.808813998703826, 65.267051017078217, 65.245759025663332, 65.847234416154521, 65.402223675604972, 65.963060686015822, 66.393714728339049, 66.152149944873202, 65.948560123103988, 65.919578114700059, 65.530799475753597, 66.144857237349797, 65.71741511500548, 65.502183406113531, 65.580937807410649, 66.13027664499063, 66.195939982347753, 66.021126760563391, 65.897858319604609, 65.516488316226258, 65.366597668591353, 65.602449158101905, 65.452165375804512, 65.502183406113531, 64.899945916711729, 64.027318322484263, 64.710957722174285, 65.760631302060503, 66.101134736146307, 65.86169045005488, 65.473592317765167, 65.210303227910003, 65.466448445171849, 66.181336863004631, 66.166740185266875, 65.739016106058941, 65.955809607562927, 65.203216692023474, 66.101134736146307, 65.623974625396485, 66.064743448579605, 66.195939982347753, 65.338124795818359, 65.231572080887148, 64.991334488734836, 65.63833278634722, 65.380843412880026, 65.775049331286993, 64.45375443119562, 66.03565925599824, 64.488392089423911, 65.63833278634722, 65.189048239895698, 65.480737749645314, 64.822817631806387, 65.167807103290968, 65.416484954208457, 65.402223675604972, 65.409353537555873, 65.437888537463195, 65.796688233358921, 64.267352185089976, 64.495324089003546, 64.794816414686821, 65.609622744669224, 65.63833278634722, 65.061808718282364, 65.281253400065282, 65.423617926071316, 65.005417118093177, 64.991334488734836, 65.153654034097087, 64.822817631806387, 64.977257959714095, 64.970221981591777, 64.047822374039285, 64.164260506897662, 65.2954619653934, 65.09710317890854, 64.857853205058916, 64.027318322484263, 64.613396510876584, 65.22448092183933, 65.352358130922553, 64.935064935064929, 65.416484954208457, 65.075921908893704, 64.530006453000652, 64.822817631806387, 63.986349578756531, 64.0, 63.959066197633511, 63.478628861616585, 64.745872450631268, 66.013862911211362, 66.291017567119653, 65.71741511500548, 65.81112207963146, 65.963060686015822, 66.115702479338836, 65.659881812212745, 65.948560123103988, 65.530799475753597, 66.101134736146307, 66.050198150594454, 65.941312232113418, 66.013862911211362, 65.695828314902002, 65.631152920586302, 65.905096660808439, 66.152149944873202, 66.006600660066013, 65.926821228436438, 66.101134736146307, 65.847234416154521, 66.101134736146307, 64.899945916711729, 64.836827317916573, 65.309676717100245, 65.054754418302068, 64.488392089423911, 64.467605028473187, 64.7878198898607, 64.391500321957508, 64.01365624666596, 64.047822374039285, 63.271116735210377, 65.259952142701763, 64.006827394922126, 65.480737749645314, 64.815815058874364, 64.676080629513848, 64.405324173465004, 64.662140316844486, 65.44502617801048, 65.402223675604972, 65.061808718282364, 65.409353537555873, 65.033600693691739, 65.588106689986887, 65.061808718282364, 65.912336592332196, 65.125366330185614, 65.616797900262469, 64.991334488734836, 65.516488316226258, 64.843834432076093, 64.752859917979706, 65.452165375804512, 65.782260717026645, 64.571674558760222, 65.423617926071316, 65.196131696186029, 65.111231687466088, 64.495324089003546, 65.040650406504071, 64.942093300140712, 64.65517241379311, 64.871878040869291, 64.808813998703826, 64.564726137953301, 65.416484954208457, 65.55944055944056, 65.80390436499232, 65.912336592332196, 65.7102179388895, 65.359477124183002, 66.02839220864972, 65.153654034097087, 65.338124795818359, 65.267051017078217, 64.509192559939791, 64.075181546347721, 65.753424657534254, 65.760631302060503, 66.217856748703227, 66.02839220864972, 65.883386406061263, 65.999340006599937, 66.101134736146307, 65.545116888791782, 65.775049331286993, 65.847234416154521, 65.955809607562927, 65.876152832674578, 65.703022339027598, 66.03565925599824, 65.818341377797282, 65.047701647875115, 64.683053040103488, 65.181966322650737, 65.984823490597165, 65.85446163977609, 65.999340006599937, 66.305669134711025, 65.78947368421052, 66.2763724732133, 65.840008778667837, 65.731814198071874, 65.631152920586302, 65.55944055944056, 65.181966322650737, 65.86169045005488, 66.115702479338836, 65.040650406504071, 65.181966322650737, 65.80390436499232, 65.63833278634722, 65.146579804560261, 65.530799475753597, 65.196131696186029, 65.373719764654609, 65.688635865995181, 65.487884741322858, 64.998375040623984, 64.963187527067987, 65.090041223692779, 65.387968613775058, 65.659881812212745, 65.832784726793946, 65.118298241805945, 64.516129032258064, 65.281253400065282, 65.160729800173769, 65.2954619653934, 65.595277140045908, 65.573770491803273, 65.160729800173769, 64.398411505849523, 65.395095367847418, 65.573770491803273, 65.090041223692779, 65.252854812398041, 64.857853205058916, 65.331010452961678, 65.167807103290968, 63.761955366631241, 57.498802108289411, 63.626723223753977, 63.728093467870423, 62.978902067807283, 64.2811227769445, 64.523066996451234, 63.599745601017595, 64.377682403433482, 64.095716269629307, 63.498782939993653, 57.915057915057915, 63.687506634115273, 65.825562260010969, 65.595277140045908, 65.876152832674578, 65.78947368421052, 65.919578114700059, 65.80390436499232, 65.281253400065282, 65.602449158101905, 65.588106689986887, 65.782260717026645, 64.343163538873995, 64.267352185089976, 64.191719268214399, 64.088869899594101, 63.606487861761906, 64.034151547492002, 64.253587491968304, 63.843370929985106, 64.46067898581866, 63.877355477483235, 59.868289762522451, 64.294899271324468, 65.890621568196792, 66.108417805200531, 66.166740185266875, 66.423115244104949, 66.072018500165171, 66.386368665633995, 65.941312232113418, 66.298342541436469, 66.02839220864972, 66.174037719201493, 65.760631302060503, 64.669109721922837, 65.373719764654609, 65.217391304347828, 64.061499039077518, 64.398411505849523, 65.316786414108421, 64.745872450631268, 64.599483204134373, 65.026552508941151, 64.412238325281805, 65.588106689986887, 64.780824875836743, 64.970221981591777, 65.580937807410649, 64.815815058874364, 65.01246072163832, 64.578624475298668, 65.2954619653934, 65.005417118093177, 64.913988964621879, 64.426071083431765, 65.132435953104647, 64.45375443119562, 64.913988964621879, 64.3707756678468, 64.86486486486487, 64.899945916711729, 65.160729800173769, 64.86486486486487, 64.71793765505339, 64.878892733564015, 65.118298241805945, 64.850843060959789, 65.068864548313627, 65.061808718282364, 64.906966681090438, 64.274236743438678, 64.662140316844486, 65.487884741322858, 63.870555673834367, 65.210303227910003, 63.9386189258312, 64.949123186836985, 64.836827317916573, 65.026552508941151, 65.054754418302068, 64.01365624666596, 65.338124795818359, 65.104166666666671, 65.181966322650737, 64.850843060959789, 65.09710317890854, 65.402223675604972, 64.935064935064929, 64.899945916711729, 65.537957400327684, 65.359477124183002, 65.203216692023474, 65.487884741322858, 65.217391304347828, 65.52364311455716, 65.480737749645314, 65.423617926071316, 64.86486486486487, 65.502183406113531, 65.331010452961678, 65.912336592332196, 66.03565925599824, 65.7102179388895, 65.580937807410649, 65.919578114700059, 65.883386406061263, 65.67425569176882, 65.17488594394959, 65.616797900262469, 64.377682403433482, 64.356966641638962, 65.681444991789817, 65.302568567696994, 65.068864548313627, 65.302568567696994, 65.090041223692779, 64.474532559638945, 65.238664781994132, 64.46067898581866], 'histories': 29985600.0, 'mean': 65.051139413615701}, 'compute-6-3.local': {'std': 0.47992153466436693, 'median': 65.026552508941151, 'rates': [64.662140316844486, 65.487884741322858, 63.870555673834367, 65.210303227910003, 63.9386189258312, 64.949123186836985, 64.836827317916573, 65.026552508941151, 65.054754418302068, 64.01365624666596, 65.338124795818359, 65.104166666666671, 65.181966322650737, 64.850843060959789, 65.09710317890854, 65.402223675604972, 64.935064935064929], 'histories': 1020000, 'mean': 64.87999465882821}, 'compute-4-18.local': {'std': 0.22292746987400008, 'median': 65.391547525127152, 'rates': [64.899945916711729, 65.537957400327684, 65.359477124183002, 65.203216692023474, 65.487884741322858, 65.217391304347828, 65.52364311455716, 65.480737749645314, 65.423617926071316, 64.86486486486487, 65.502183406113531, 65.331010452961678], 'histories': 720000, 'mean': 65.319327557760872}, 'compute-5-7.local': {'std': 0.15038065052247726, 'median': 65.897861499196722, 'rates': [65.912336592332196, 66.03565925599824, 65.7102179388895, 65.580937807410649, 65.919578114700059, 65.883386406061263], 'histories': 360000, 'mean': 65.840352685898651}, 'compute-5-20.local': {'std': 0.453406252190314, 'median': 65.238727255823292, 'rates': [65.67425569176882, 65.17488594394959, 65.616797900262469, 64.377682403433482, 64.356966641638962, 65.681444991789817, 65.302568567696994, 65.068864548313627, 65.302568567696994, 65.090041223692779], 'histories': 600000, 'mean': 65.164607648024344}, 'compute-4-20.local': {'std': 0.36352470094889511, 'median': 64.474532559638945, 'rates': [64.474532559638945, 65.238664781994132, 64.46067898581866], 'histories': 180000, 'mean': 64.724625442483912}})
|
222 : |
|
|
|
223 : |
|
|
|
224 : |
|
|
def mon_par(mon):
|
225 : |
|
|
"""Parseado de la informacion de monitorizacion"""
|
226 : |
|
|
histories=dict()
|
227 : |
|
|
mean=dict()
|
228 : |
|
|
std=dict()
|
229 : |
|
|
rates=dict()
|
230 : |
|
|
median=dict()
|
231 : |
|
|
if mon[0]==2 or mon[0]==4:
|
232 : |
|
|
nodes= mon[1]
|
233 : |
|
|
for i in nodes:
|
234 : |
|
|
for k in nodes[i]:
|
235 : |
|
|
data=nodes[i][k]
|
236 : |
|
|
if 'Histories' in k.capitalize():
|
237 : |
|
|
histories[i]=data
|
238 : |
|
|
if 'Mean' in k.capitalize():
|
239 : |
|
|
mean[i]=data
|
240 : |
|
|
if 'Std' in k.capitalize():
|
241 : |
|
|
std[i]=data
|
242 : |
|
|
if 'Rates' in k.capitalize():
|
243 : |
|
|
rates[i]=data
|
244 : |
|
|
if 'median' in k.capitalize():
|
245 : |
|
|
median[i]=data
|
246 : |
|
|
|
247 : |
|
|
|
248 : |
|
|
|
249 : |
|
|
"""<?xml version='1.0'?>
|
250 : |
|
|
<qhost xmlns:xsd="http://gridscheduler.svn.sourceforge.net/viewvc/gridscheduler/trunk/source/dist/util/resources/schemas/qhost/qhost.xsd?revision=11">
|
251 : |
|
|
<host name='global'>
|
252 : |
|
|
<hostvalue name='arch_string'>-</hostvalue>
|
253 : |
|
|
<hostvalue name='num_proc'>-</hostvalue>
|
254 : |
|
|
<hostvalue name='load_avg'>-</hostvalue>
|
255 : |
|
|
<hostvalue name='mem_total'>-</hostvalue>
|
256 : |
|
|
<hostvalue name='mem_used'>-</hostvalue>
|
257 : |
|
|
<hostvalue name='swap_total'>-</hostvalue>
|
258 : |
|
|
<hostvalue name='swap_used'>-</hostvalue>
|
259 : |
|
|
</host>
|
260 : |
|
|
<host name='client-4199'>
|
261 : |
|
|
<hostvalue name='arch_string'>linux-x64</hostvalue>
|
262 : |
|
|
<hostvalue name='num_proc'>1</hostvalue>
|
263 : |
|
|
<hostvalue name='load_avg'>0.00</hostvalue>
|
264 : |
|
|
<hostvalue name='mem_total'>252.8M</hostvalue>
|
265 : |
|
|
<hostvalue name='mem_used'>29.1M</hostvalue>
|
266 : |
|
|
<hostvalue name='swap_total'>0.0</hostvalue>
|
267 : |
|
|
<hostvalue name='swap_used'>0.0</hostvalue>
|
268 : |
|
|
</host>
|
269 : |
|
|
<host name='client-4200'>
|
270 : |
|
|
<hostvalue name='arch_string'>linux-x64</hostvalue>
|
271 : |
|
|
<hostvalue name='num_proc'>1</hostvalue>
|
272 : |
|
|
<hostvalue name='load_avg'>0.00</hostvalue>
|
273 : |
|
|
<hostvalue name='mem_total'>252.8M</hostvalue>
|
274 : |
|
|
<hostvalue name='mem_used'>29.1M</hostvalue>
|
275 : |
|
|
<hostvalue name='swap_total'>0.0</hostvalue>
|
276 : |
|
|
<hostvalue name='swap_used'>0.0</hostvalue>
|
277 : |
|
|
</host>
|
278 : |
|
|
</qhost>"""
|
279 : |
|
|
|
280 : |
|
|
def xml_qhost(code):
|
281 : |
|
|
"Parsea la salida xml del qhost y devuelve los nodos disponibles"
|
282 : |
|
|
|
283 : |
|
|
elements = tree.fromstring(code)
|
284 : |
|
|
nodes=0
|
285 : |
|
|
for sub in elements.iter():
|
286 : |
|
|
if(sub.tag == 'host'):
|
287 : |
|
|
#Imprime atributos de ese tag. Devuelve un diccionario
|
288 : |
|
|
hostname = sub.attrib['name']
|
289 : |
|
|
if 'global' not in hostname:
|
290 : |
|
|
nodes=nodes+1
|
291 : |
|
|
|
292 : |
|
|
return nodes
|
293 : |
|
|
|
294 : |
|
|
|
295 : |
|
|
|
|