Commit e2104d1e authored by Leo Gordon's avatar Leo Gordon
Browse files

this change should speed everything up

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