Commit 2952e74e authored by Leo Gordon's avatar Leo Gordon
Browse files

optimization: worker should not sync analyses it is not ready to run

parent a744dfb2
......@@ -99,7 +99,7 @@ sub fetch_by_needed_workers {
my ($self, $limit, $resource_class_id) = @_;
my $constraint = "ast.num_required_workers>0 AND ast.status in ('READY','WORKING')"
.(defined($resource_class_id) ? " AND ast.resource_class_id = $resource_class_id" : '');
.($resource_class_id ? " AND ast.resource_class_id = $resource_class_id" : '');
my $final_clause = 'ORDER BY priority DESC, '
.( ($self->dbc->driver eq 'sqlite') ? 'RANDOM()' : 'RAND()' )
......@@ -117,7 +117,7 @@ sub fetch_by_statuses {
my ($self, $statuses, $resource_class_id) = @_;
my $constraint = 'ast.status in ('.join(', ', map { "'$_'" } @$statuses).')'
.(defined($resource_class_id) ? " AND ast.resource_class_id = $resource_class_id" : '');
.($resource_class_id ? " AND ast.resource_class_id = $resource_class_id" : '');
$self->_final_clause('ORDER BY last_update');
my $results = $self->_generic_fetch($constraint);
......
......@@ -934,15 +934,15 @@ sub _pick_best_analysis_for_new_worker {
return $stats if(($stats->status ne 'BLOCKED') and ($stats->num_required_workers > 0) and (!defined($rc_id) or ($stats->resource_class_id == $rc_id)));
}
# ok so no analyses 'need' workers with the given $rc_id.
# ok so no analyses 'need' workers with the given $rc_id.
if ($self->get_num_failed_analyses()) {
return undef;
}
# see if anything needs an update, in case there are
# hidden jobs that haven't made it into the summary stats
# see if any analysis needs an update, in case there are hidden jobs that haven't made it into the summary stats:
print("QUEEN: no obvious needed workers, need to dig deeper\n");
my $stats_list = $statsDBA->fetch_by_statuses(['LOADING', 'BLOCKED', 'ALL_CLAIMED']);
my $stats_list = $statsDBA->fetch_by_statuses(['LOADING', 'BLOCKED', 'ALL_CLAIMED'], $rc_id);
foreach $stats (@$stats_list) {
$self->safe_synchronize_AnalysisStats($stats);
......
Markdown is supported
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