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
98eb2e34
Commit
98eb2e34
authored
Jun 08, 2004
by
Jessica Severin
Browse files
added method update_analysis_stats which queries the analysis_job table
and summarizes it's state via analysis_stats.
parent
f5270d73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
2 deletions
+56
-2
modules/Bio/EnsEMBL/Hive/Queen.pm
modules/Bio/EnsEMBL/Hive/Queen.pm
+56
-2
No files found.
modules/Bio/EnsEMBL/Hive/Queen.pm
View file @
98eb2e34
...
...
@@ -86,7 +86,7 @@ sub create_new_worker {
my
$analStatsDBA
=
$self
->
db
->
get_AnalysisStatsAdaptor
;
return
undef
unless
(
$analStatsDBA
);
my
$analysisStats
=
$analStatsDBA
->
fetch_by_
dbID
(
$analysis_id
);
my
$analysisStats
=
$analStatsDBA
->
fetch_by_
analysis_id
(
$analysis_id
);
return
undef
unless
(
$analysisStats
);
$analysisStats
->
print_stats
;
...
...
@@ -116,7 +116,7 @@ sub create_new_worker {
$worker
=
undef
unless
(
$worker
and
$worker
->
analysis
);
if
(
$worker
and
$analysisStats
)
{
$anal
ysis
Stats
->
status
(
'
WORKING
');
$analStats
DBA
->
update_status
(
$analysis_id
,
'
WORKING
');
}
return
$worker
;
}
...
...
@@ -173,6 +173,60 @@ sub fetch_overdue_workers {
}
sub
update_analysis_stats
{
my
$self
=
shift
;
my
$sql
=
"
SELECT analysis.analysis_id, status, count(*)
"
.
"
FROM analysis_job, analysis
"
.
"
WHERE analysis_job.analysis_id=analysis.analysis_id
"
.
"
GROUP BY analysis_job.analysis_id, status
";
my
$statsDBA
=
$self
->
db
->
get_AnalysisStatsAdaptor
;
my
$analysisStats
=
undef
;
my
$sth
=
$self
->
prepare
(
$sql
);
$sth
->
execute
();
while
(
my
(
$analysis_id
,
$status
,
$count
)
=
$sth
->
fetchrow_array
())
{
unless
(
defined
(
$analysisStats
)
and
$analysisStats
->
analysis_id
==
$analysis_id
)
{
if
(
$analysisStats
and
(
$analysisStats
->
status
ne
'
BLOCKED
'))
{
if
(
$analysisStats
->
total_job_count
==
$analysisStats
->
done_job_count
)
{
$analysisStats
->
status
('
DONE
');
}
if
(
$analysisStats
->
total_job_count
==
$analysisStats
->
unclaimed_job_count
)
{
$analysisStats
->
status
('
READY
');
}
if
(
$analysisStats
->
unclaimed_job_count
>
0
and
$analysisStats
->
total_job_count
>
$analysisStats
->
unclaimed_job_count
)
{
$analysisStats
->
status
('
WORKING
');
}
$statsDBA
->
update
(
$analysisStats
);
}
$analysisStats
=
$statsDBA
->
fetch_by_analysis_id
(
$analysis_id
);
$analysisStats
->
total_job_count
(
0
);
$analysisStats
->
unclaimed_job_count
(
0
);
$analysisStats
->
done_job_count
(
0
);
$analysisStats
->
num_required_workers
(
0
);
}
my
$total
=
$analysisStats
->
total_job_count
();
$analysisStats
->
total_job_count
(
$total
+
$count
);
if
(
$status
eq
'
READY
')
{
$analysisStats
->
unclaimed_job_count
(
$count
);
my
$numWorkers
=
$count
/
$analysisStats
->
batch_size
;
if
(
$numWorkers
>
$analysisStats
->
hive_capacity
)
{
$numWorkers
=
$analysisStats
->
hive_capacity
;
}
$analysisStats
->
num_required_workers
(
$numWorkers
);
}
if
(
$status
eq
'
DONE
')
{
$analysisStats
->
done_job_count
(
$count
);
}
}
$sth
->
finish
;
}
#
# INTERNAL METHODS
#
...
...
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