Commit b213bd15 authored by Jessica Severin's avatar Jessica Severin
Browse files

added failed_job_count to analysis_stats to track as a distinct value

parent 1c30321e
......@@ -100,6 +100,13 @@ sub done_job_count {
return $self->{'_done_job_count'};
}
sub failed_job_count {
my $self = shift;
$self->{'_failed_job_count'} = shift if(@_);
$self->{'_failed_job_count'} = 0 unless(defined($self->{'_failed_job_count'}));
return $self->{'_failed_job_count'};
}
sub num_required_workers {
my $self = shift;
$self->{'_num_required_workers'} = shift if(@_);
......@@ -117,7 +124,7 @@ sub determine_status {
if($self->status ne 'BLOCKED') {
if($self->done_job_count>0 and
$self->total_job_count == $self->done_job_count) {
$self->total_job_count == $self->done_job_count + $self->failed_job_count) {
$self->status('DONE');
}
if($self->total_job_count == $self->unclaimed_job_count) {
......@@ -135,11 +142,11 @@ sub print_stats {
my $self = shift;
#printf("STATS %20s(%3d) %11s jobs(%7d:t,%7d:q,%7d:d) %5d:batchsize %5d:hiveCapacity %5d:neededWorkers (synched %d secs ago)\n",
printf("STATS %20s(%3d) %12s jobs(t=%d,q=%d,d=%d) batchsize=%d hiveCapacity=%d neededWorkers=%d (synched %d secs ago)\n",
printf("STATS %20s(%3d) %12s jobs(t=%d,q=%d,d=%d,f=%d) batchsize=%d hiveCapacity=%d neededWorkers=%d (synched %d secs ago)\n",
$self->get_analysis->logic_name,
$self->analysis_id,
$self->status,
$self->total_job_count,$self->unclaimed_job_count,$self->done_job_count,
$self->total_job_count,$self->unclaimed_job_count,$self->done_job_count,$self->failed_job_count,
$self->batch_size,$self->hive_capacity(),$self->num_required_workers,
$self->seconds_since_last_update);
}
......
......@@ -129,6 +129,7 @@ sub update {
$sql .= ",total_job_count=" . $stats->total_job_count();
$sql .= ",unclaimed_job_count=" . $stats->unclaimed_job_count();
$sql .= ",done_job_count=" . $stats->done_job_count();
$sql .= ",failed_job_count=" . $stats->failed_job_count();
$sql .= ",num_required_workers=" . $stats->num_required_workers();
$sql .= ",last_update=NOW()";
$sql .= " WHERE analysis_id='".$stats->analysis_id."' ";
......@@ -256,6 +257,7 @@ sub _columns {
ast.total_job_count
ast.unclaimed_job_count
ast.done_job_count
ast.failed_job_count
ast.num_required_workers
ast.last_update
);
......@@ -281,6 +283,7 @@ sub _objs_from_sth {
$analStats->total_job_count($column{'total_job_count'});
$analStats->unclaimed_job_count($column{'unclaimed_job_count'});
$analStats->done_job_count($column{'done_job_count'});
$analStats->failed_job_count($column{'failed_job_count'});
$analStats->num_required_workers($column{'num_required_workers'});
$analStats->seconds_since_last_update($column{'seconds_since_last_update'});
$analStats->adaptor($self);
......
......@@ -214,6 +214,7 @@ sub update_analysis_stats {
$analysisStats->total_job_count(0);
$analysisStats->unclaimed_job_count(0);
$analysisStats->done_job_count(0);
$analysisStats->failed_job_count(0);
$analysisStats->num_required_workers(0);
}
......@@ -229,10 +230,8 @@ sub update_analysis_stats {
}
$analysisStats->num_required_workers($numWorkers);
}
if(($status eq 'DONE') or ($status eq 'FAILED')) {
$count += $analysisStats->done_job_count();
$analysisStats->done_job_count($count);
}
if($status eq 'DONE') { $analysisStats->done_job_count($count); }
if($status eq 'FAILED') { $analysisStats->failed_job_count($count); }
}
$analysisStats->determine_status()->update() if($analysisStats);
$sth->finish;
......
......@@ -213,6 +213,7 @@ CREATE TABLE analysis_stats (
total_job_count int(10) NOT NULL,
unclaimed_job_count int(10) NOT NULL,
done_job_count int(10) NOT NULL,
failed_job_count int(10) NOT NULL,
num_required_workers int(10) NOT NULL,
last_update timestamp NOT NULL,
......
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