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

this change should speed everything up

parent 0656dc9e
No related branches found
No related tags found
No related merge requests found
......@@ -478,20 +478,20 @@ sub synchronize_AnalysisStats {
$analysisStats->failed_job_count(0);
$analysisStats->num_required_workers(0);
my $sql = "SELECT status, count(*), semaphore_count>0 semaphored FROM analysis_job ".
"WHERE analysis_id=? GROUP BY status, semaphored";
my $sql = "SELECT status, count(*), semaphore_count FROM analysis_job ".
"WHERE analysis_id=? GROUP BY status, semaphore_count";
my $sth = $self->prepare($sql);
$sth->execute($analysisStats->analysis_id);
my $hive_capacity = $analysisStats->hive_capacity;
while (my ($status, $count, $semaphored)=$sth->fetchrow_array()) {
while (my ($status, $count, $semaphore_count)=$sth->fetchrow_array()) {
# print STDERR "$status - $count\n";
my $total = $analysisStats->total_job_count();
$analysisStats->total_job_count($total + $count);
if(($status eq 'READY') and !$semaphored) {
if(($status eq 'READY') and ($semaphore_count<=0)) {
$analysisStats->unclaimed_job_count($count);
my $numWorkers;
if($analysisStats->batch_size > 0) {
......
......@@ -139,7 +139,7 @@ CREATE TABLE analysis_job (
PRIMARY KEY (analysis_job_id),
UNIQUE KEY input_id_analysis (input_id, analysis_id),
INDEX claim_analysis_status (job_claim, analysis_id, status),
INDEX analysis_status (analysis_id, status),
INDEX analysis_status (analysis_id, status, semaphore_count),
INDEX worker_id (worker_id)
) ENGINE=InnoDB;
......
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