Skip to content
Snippets Groups Projects
Commit c9c80323 authored by Leo Gordon's avatar Leo Gordon
Browse files

API change: changed the order of arguments in...

API change: changed the order of arguments in suggest_analysis_to_specialize_a_worker() and simplified filtering
parent 6cbd7789
No related branches found
No related tags found
No related merge requests found
......@@ -116,7 +116,11 @@ sub fetch_all_by_pattern {
my $analyses;
if( $pattern=~/^\d+$/ ) {
if( not defined($pattern) ) {
$analyses = $self->fetch_all();
} elsif( $pattern=~/^\d+$/ ) {
$analyses = $self->fetch_all_by_analysis_id( $pattern );
......
......@@ -272,7 +272,7 @@ sub specialize_new_worker {
}
}
# probably scheduled by beekeeper.pl:
} elsif( $stats = Bio::EnsEMBL::Hive::Scheduler::suggest_analysis_to_specialize_a_worker($analyses_pattern, $worker) ) {
} elsif( $stats = Bio::EnsEMBL::Hive::Scheduler::suggest_analysis_to_specialize_a_worker($worker, $analyses_pattern) ) {
$analysis = $stats->analysis;
} else {
......
......@@ -124,24 +124,17 @@ sub schedule_workers_resync_if_necessary {
sub suggest_analysis_to_specialize_a_worker {
my ( $analyses_pattern, $worker ) = @_;
my ( $worker, $analyses_pattern ) = @_;
my $queen = $worker->adaptor;
my $analysis_adaptor = $queen->db->get_AnalysisAdaptor;
my $worker_rc_id = $worker->resource_class_id;
my $worker_meadow_type = $worker->meadow_type;
my @only_analyses = ();
foreach my $analysis ( @{ $analyses_pattern ? $analysis_adaptor->fetch_all_by_pattern( $analyses_pattern ) : $analysis_adaptor->fetch_all() } ) {
next if($worker_rc_id and $worker_rc_id!=$analysis->resource_class_id);
next if($worker_meadow_type and $analysis->meadow_type and $worker_meadow_type ne $analysis->meadow_type);
# if any other attributes of the worker are specifically constrained in the analysis (such as meadow_name), the corresponding checks should be added here.
push @only_analyses, $analysis;
}
my @only_analyses = grep { !$worker_rc_id or $worker_rc_id==$_->resource_class_id}
grep { !$worker_meadow_type or !$_->meadow_type or ($worker_meadow_type eq $_->meadow_type) }
# if any other attributes of the worker are specifically constrained in the analysis (such as meadow_name),
# the corresponding checks should be added here
@{ $queen->db->get_AnalysisAdaptor->fetch_all_by_pattern( $analyses_pattern ) };
return schedule_workers( $queen, 1, $worker_meadow_type, \@only_analyses );
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment