Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
574ea28c
Commit
574ea28c
authored
Apr 24, 2014
by
Leo Gordon
Browse files
moving code that stores resource usage into Queen::store_resource_usage and calling it from there
parent
8ad9df2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
modules/Bio/EnsEMBL/Hive/Queen.pm
modules/Bio/EnsEMBL/Hive/Queen.pm
+26
-0
scripts/lsf_report.pl
scripts/lsf_report.pl
+3
-12
No files found.
modules/Bio/EnsEMBL/Hive/Queen.pm
View file @
574ea28c
...
...
@@ -416,6 +416,11 @@ sub check_for_dead_workers { # scans the whole Valley for lost Workers (but i
$worker
->
cause_of_death
(
$report_entries
->
{
$process_id
}{'
cause_of_death
'}
);
$self
->
register_worker_death
(
$worker
);
}
if
(
%$report_entries
)
{
# use the opportunity to also store resource usage of the buried workers:
my
$processid_2_workerid
=
{
map
{
$_
=>
$pid_to_lost_worker
->
{
$_
}
->
dbID
}
keys
%$pid_to_lost_worker
};
$self
->
store_resource_usage
(
$report_entries
,
$processid_2_workerid
);
}
}
}
...
...
@@ -752,4 +757,25 @@ sub register_all_workers_dead {
}
sub
store_resource_usage
{
my
(
$self
,
$report_entries
,
$processid_2_workerid
)
=
@_
;
my
$sql_replace
=
'
REPLACE INTO worker_resource_usage (worker_id, exit_status, mem_megs, swap_megs, pending_sec, cpu_sec, lifespan_sec, exception_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
';
my
$sth_replace
=
$self
->
prepare
(
$sql_replace
);
my
@not_ours
=
();
while
(
my
(
$process_id
,
$report_entry
)
=
each
%$report_entries
)
{
if
(
my
$worker_id
=
$processid_2_workerid
->
{
$process_id
}
)
{
$sth_replace
->
execute
(
$worker_id
,
@$report_entry
{'
exit_status
',
'
mem_megs
',
'
swap_megs
',
'
pending_sec
',
'
cpu_sec
',
'
lifespan_sec
',
'
exception_status
'}
);
# slicing hashref
}
else
{
push
@not_ours
,
$process_id
;
#warn "\tDiscarding process_id=$process_id as probably not ours because it could not be mapped to a Worker\n";
}
}
$sth_replace
->
finish
();
}
1
;
scripts/lsf_report.pl
View file @
574ea28c
...
...
@@ -111,20 +111,11 @@ sub main {
my
$report_entries
=
Bio::EnsEMBL::Hive::Meadow::LSF::
parse_report_source_line
(
$bacct_source_line
);
my
$
processid_2_workerid
=
$hive_dba
->
get_WorkerAdaptor
()
->
fetch_by_meadow_type_AND_meadow_name_HASHED_FROM_process_id_TO_worker_id
(
'
LSF
',
$this_lsf_farm
)
;
my
$
queen
=
$hive_dba
->
get_Queen
;
my
$
sth_replace
=
$dbc
->
prepare
(
'
REPLACE INTO worker_resource_usage (worker_id, exit_status, mem_megs, swap_megs, pending_sec, cpu_sec, lifespan_sec, exception_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
'
);
my
$
processid_2_workerid
=
$queen
->
fetch_by_meadow_type_AND_meadow_name_HASHED_FROM_process_id_TO_worker_id
(
'
LSF
',
$this_lsf_farm
);
while
(
my
(
$process_id
,
$report_entry
)
=
each
%$report_entries
)
{
if
(
my
$worker_id
=
$processid_2_workerid
->
{
$process_id
}
)
{
$sth_replace
->
execute
(
$worker_id
,
@$report_entry
{'
exit_status
',
'
mem_megs
',
'
swap_megs
',
'
pending_sec
',
'
cpu_sec
',
'
lifespan_sec
',
'
exception_status
'}
);
# slicing hashref
}
else
{
warn
"
\t
Discarding process_id=
$process_id
as probably not ours because it could not be mapped to a Worker
\n
";
}
}
$sth_replace
->
finish
();
warn
"
\n
Report has been loaded into pipeline's 'worker_resource_usage' table. Enjoy.
\n
";
$queen
->
store_resource_usage
(
$report_entries
,
$processid_2_workerid
);
}
__DATA__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment