Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P1820
Sum h_vmem per host
Active
Public
Actions
Authored by
scfc
on Aug 3 2015, 10:55 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Project Tags
Toolforge
Referenced Files
F356878: Sum h_vmem per host
Aug 3 2015, 10:55 PM
2015-08-03 22:55:18 (UTC+0)
Subscribers
None
#!/usr/bin/perl -w
use
strict
;
use
warnings
;
use
XML::LibXML
;
my
$XMLParser
=
new
XML::
LibXML
()
or
die
(
$!
);
my
$Hosts
=
$XMLParser
->
parse_file
(
'/home/scfc/hosts.xml'
)
or
die
(
$!
);
# qhost -xml -j -F h_vmem
my
$Jobs
=
$XMLParser
->
parse_file
(
'/home/scfc/jobs.xml'
)
or
die
(
$!
);
# qstat -j \* -xml
foreach
my
$Host
(
$Hosts
->
findnodes
(
q!/qhost/host[not(@name = 'global')]!
))
{
my
$h_vmem
=
0
;
foreach
my
$Job
(
$Host
->
findnodes
(
'job'
))
{
my
$JobNr
=
$Job
->
getAttribute
(
'name'
);
foreach
my
$v
(
$Jobs
->
findnodes
(
"/detailed_job_info/djob_info/element[JB_job_number = $JobNr]/JB_hard_resource_list/qstat_l_requests[CE_name = 'h_vmem']/CE_doubleval"
))
{
$h_vmem
+=
$v
->
textContent
();
}
}
printf
"%s %f\n"
,
$Host
->
getAttribute
(
'name'
),
$h_vmem
/ 1024 /
1024
/
1024
;
}
Event Timeline
scfc
edited the content of this paste.
(Show Details)
Aug 3 2015, 10:55 PM
2015-08-03 22:55:18 (UTC+0)
scfc
changed the title of this paste from untitled to
Sum h_vmem per host
.
scfc
updated the paste's language from
autodetect
to
perl
.
scfc
added a project:
Toolforge
.
scfc
mentioned this in
T107665: Determine and deploy proper h_vmem resources for execution nodes
.
Aug 3 2015, 11:02 PM
2015-08-03 23:02:02 (UTC+0)
scfc
mentioned this in
T152045: Cannot find paste authored by me
.
Nov 30 2016, 9:10 PM
2016-11-30 21:10:27 (UTC+0)
Stashbot
mentioned this in
T263986: Convert P1820 from string to external ID
.
Oct 7 2020, 2:04 PM
2020-10-07 14:04:16 (UTC+0)
Log In to Comment