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

(multi-meadow scheduler) restrict the set of analyses that a worker with a...

(multi-meadow scheduler) restrict the set of analyses that a worker with a given meadow_type can specialize into
parent 55de1985
No related branches found
No related tags found
No related merge requests found
...@@ -79,10 +79,13 @@ sub fetch_by_analysis_id { ...@@ -79,10 +79,13 @@ sub fetch_by_analysis_id {
} }
sub fetch_all_by_suitability_rc_id { sub fetch_all_by_suitability_rc_id_meadow_type {
my ($self, $resource_class_id) = @_; my ($self, $resource_class_id, $meadow_type) = @_;
my $join = [[['analysis_base', 'a'], " ast.analysis_id=a.analysis_id ".( $resource_class_id ? "AND a.resource_class_id=$resource_class_id " : '') ]]; my $join = [[ ['analysis_base', 'a'], " ast.analysis_id=a.analysis_id "
.( $resource_class_id ? "AND a.resource_class_id=$resource_class_id " : '')
.( $meadow_type ? "AND (a.meadow_type IS NULL OR a.meadow_type='$meadow_type') " : '')
]];
# the ones that clearly have work to do: # the ones that clearly have work to do:
# #
......
...@@ -257,7 +257,7 @@ sub specialize_new_worker { ...@@ -257,7 +257,7 @@ sub specialize_new_worker {
} else { # probably scheduled by beekeeper.pl } else { # probably scheduled by beekeeper.pl
$stats = $self->suggest_analysis_to_specialize_by_rc_id($worker->resource_class_id) $stats = $self->suggest_analysis_to_specialize_by_rc_id_meadow_type($worker->resource_class_id, $worker->meadow_type)
or die "Queen failed to pick an analysis for the worker"; or die "Queen failed to pick an analysis for the worker";
print "Queen picked analysis with dbID=".$stats->analysis_id." for the worker\n"; print "Queen picked analysis with dbID=".$stats->analysis_id." for the worker\n";
...@@ -838,11 +838,12 @@ sub register_all_workers_dead { ...@@ -838,11 +838,12 @@ sub register_all_workers_dead {
} }
sub suggest_analysis_to_specialize_by_rc_id { sub suggest_analysis_to_specialize_by_rc_id_meadow_type {
my $self = shift; my $self = shift;
my $rc_id = shift; my $rc_id = shift;
my $meadow_type = shift;
my @suitable_analyses = @{ $self->db->get_AnalysisStatsAdaptor->fetch_all_by_suitability_rc_id( $rc_id ) }; my @suitable_analyses = @{ $self->db->get_AnalysisStatsAdaptor->fetch_all_by_suitability_rc_id_meadow_type( $rc_id, $meadow_type ) };
foreach my $stats (@suitable_analyses) { foreach my $stats (@suitable_analyses) {
......
...@@ -64,7 +64,7 @@ sub schedule_workers { ...@@ -64,7 +64,7 @@ sub schedule_workers {
my @suitable_analyses = $filter_analysis my @suitable_analyses = $filter_analysis
? ( $filter_analysis->stats ) ? ( $filter_analysis->stats )
: @{ $queen->db->get_AnalysisStatsAdaptor->fetch_all_by_suitability_rc_id() }; : @{ $queen->db->get_AnalysisStatsAdaptor->fetch_all_by_suitability_rc_id_meadow_type() };
unless(@suitable_analyses) { unless(@suitable_analyses) {
print "Scheduler could not find any suitable analyses to start with\n"; print "Scheduler could not find any suitable analyses to start with\n";
......
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