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
2af05379
Commit
2af05379
authored
May 22, 2012
by
Leo Gordon
Browse files
simplified output interface from schedule_workers and schedule_workers_resync_if_necessary
parent
2dcf5e7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
modules/Bio/EnsEMBL/Hive/Queen.pm
modules/Bio/EnsEMBL/Hive/Queen.pm
+16
-17
scripts/beekeeper.pl
scripts/beekeeper.pl
+2
-2
No files found.
modules/Bio/EnsEMBL/Hive/Queen.pm
View file @
2af05379
...
...
@@ -673,20 +673,17 @@ sub count_running_workers {
sub
schedule_workers
{
my
(
$self
,
$filter_analysis
,
$orig_pending_by_rc_id
,
$available_submit_limit
)
=
@_
;
my
$statsDBA
=
$self
->
db
->
get_AnalysisStatsAdaptor
;
my
$clearly_needed_analyses
=
$statsDBA
->
fetch_by_needed_workers
(
undef
);
my
$potentially_needed_analyses
=
$statsDBA
->
fetch_by_statuses
(['
LOADING
',
'
BLOCKED
',
'
ALL_CLAIMED
']);
my
@all_analyses
=
(
@$clearly_needed_analyses
,
@$potentially_needed_analyses
);
return
0
unless
(
@all_analyses
);
my
$statsDBA
=
$self
->
db
->
get_AnalysisStatsAdaptor
;
my
$clearly_needed_analyses
=
$statsDBA
->
fetch_by_needed_workers
(
undef
);
my
$potentially_needed_analyses
=
$statsDBA
->
fetch_by_statuses
(['
LOADING
',
'
BLOCKED
',
'
ALL_CLAIMED
']);
my
@all_analyses
=
(
@$clearly_needed_analyses
,
@$potentially_needed_analyses
);
my
$available_load
=
1.0
-
$self
->
get_hive_current_load
(
);
return
{}
unless
(
@all_analyses
);
return
0
if
(
$available_load
<=
0.0
);
my
%pending_by_rc_id
=
%
{
$orig_pending_by_rc_id
||
{}
};
my
$total_workers_to_run
=
0
;
my
%workers_to_run_by_rc_id
=
();
my
%pending_by_rc_id
=
%
{
$orig_pending_by_rc_id
||
{}
};
my
$total_workers_to_run
=
0
;
my
%workers_to_run_by_rc_id
=
();
my
$available_load
=
1.0
-
$self
->
get_hive_current_load
();
foreach
my
$analysis_stats
(
@all_analyses
)
{
last
if
(
$available_load
<=
0.0
);
...
...
@@ -729,6 +726,8 @@ sub schedule_workers {
$pending_by_rc_id
{
$curr_rc_id
}
-=
$pending_this_analysis
;
}
next
unless
(
$workers_this_analysis
);
# do not autovivify the hash by a zero
$total_workers_to_run
+=
$workers_this_analysis
;
$workers_to_run_by_rc_id
{
$curr_rc_id
}
+=
$workers_this_analysis
;
$analysis_stats
->
print_stats
();
...
...
@@ -736,7 +735,7 @@ sub schedule_workers {
}
printf
("
Scheduler suggests adding a total of %d workers [%1.5f hive_load remaining]
\n
",
$total_workers_to_run
,
$available_load
);
return
(
$total_workers_to_run
,
\
%workers_to_run_by_rc_id
)
;
return
\
%workers_to_run_by_rc_id
;
}
...
...
@@ -751,18 +750,18 @@ sub schedule_workers_resync_if_necessary {
?
((
$submit_limit
<
$meadow_limit
)
?
$submit_limit
:
$meadow_limit
)
:
(
defined
(
$submit_limit
)
?
$submit_limit
:
$meadow_limit
);
my
(
$total_workers_to_run
,
$workers_to_run_by_rc_id
)
=
$self
->
schedule_workers
(
$analysis
,
$pending_by_rc_id
,
$available_submit_limit
);
my
$workers_to_run_by_rc_id
=
$self
->
schedule_workers
(
$analysis
,
$pending_by_rc_id
,
$available_submit_limit
);
unless
(
$total_
workers_to_run
or
$self
->
get_hive_current_load
()
or
$self
->
count_running_workers
()
)
{
unless
(
keys
%$
workers_to_run
_by_rc_id
or
$self
->
get_hive_current_load
()
or
$self
->
count_running_workers
()
)
{
print
"
*** nothing is running and nothing to do (according to analysis_stats) => perform a hard resync
\n
"
;
$self
->
check_for_dead_workers
(
$meadow
,
1
);
$self
->
synchronize_hive
(
$analysis
);
(
$total_workers_to_run
,
$workers_to_run_by_rc_id
)
=
$self
->
schedule_workers
(
$analysis
,
$pending_by_rc_id
,
$available_submit_limit
);
$workers_to_run_by_rc_id
=
$self
->
schedule_workers
(
$analysis
,
$pending_by_rc_id
,
$available_submit_limit
);
}
return
(
$total_workers_to_run
,
$workers_to_run_by_rc_id
)
;
return
$workers_to_run_by_rc_id
;
}
...
...
scripts/beekeeper.pl
View file @
2af05379
...
...
@@ -370,9 +370,9 @@ sub run_autonomously {
$queen
->
print_analysis_status
unless
(
$self
->
{'
no_analysis_stats
'});
$queen
->
print_running_worker_status
;
my
(
$total_workers_to_run
,
$workers_to_run_by_rc_id
)
=
$queen
->
schedule_workers_resync_if_necessary
(
$current_meadow
,
$this_analysis
);
my
$workers_to_run_by_rc_id
=
$queen
->
schedule_workers_resync_if_necessary
(
$current_meadow
,
$this_analysis
);
if
(
$total_
workers_to_run
)
{
if
(
keys
%$
workers_to_run
_by_rc_id
)
{
foreach
my
$rc_id
(
sort
{
$workers_to_run_by_rc_id
->
{
$a
}
<=>
$workers_to_run_by_rc_id
->
{
$b
}
}
keys
%$workers_to_run_by_rc_id
)
{
my
$this_rc_worker_count
=
$workers_to_run_by_rc_id
->
{
$rc_id
};
...
...
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