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

bugfix: avoid getting negative analysis_stats.ready_job_count by separating...

bugfix: avoid getting negative analysis_stats.ready_job_count by separating the "grab" and "release" phases of batching
parents f71e4adf fa0fd628
......@@ -177,6 +177,17 @@ sub update_status {
}
sub interval_update_claim {
my ($self, $analysis_id, $job_count) = @_;
unless( $self->db->hive_use_triggers() ) {
my $sql = "UPDATE analysis_stats SET ready_job_count = ready_job_count - $job_count WHERE analysis_id= $analysis_id";
$self->dbc->do( $sql );
}
}
=head2 interval_update_work_done
Arg [1] : int $analysis_id
......@@ -214,12 +225,11 @@ sub interval_update_work_done {
avg_input_msec_per_job = (((done_job_count*avg_input_msec_per_job)/$weight_factor + $fetching_msec) / (done_job_count/$weight_factor + $job_count)),
avg_run_msec_per_job = (((done_job_count*avg_run_msec_per_job)/$weight_factor + $running_msec) / (done_job_count/$weight_factor + $job_count)),
avg_output_msec_per_job = (((done_job_count*avg_output_msec_per_job)/$weight_factor + $writing_msec) / (done_job_count/$weight_factor + $job_count)),
ready_job_count = ready_job_count - $job_count,
done_job_count = done_job_count + $job_count
WHERE analysis_id= $analysis_id
};
$self->dbc->do($sql);
$self->dbc->do( $sql );
}
......
......@@ -509,6 +509,7 @@ sub run {
my $actual_batch = $job_adaptor->grab_jobs_for_role( $current_role, $desired_batch_size );
if(scalar(@$actual_batch)) {
$self->adaptor->db->get_AnalysisStatsAdaptor->interval_update_claim($self->current_role->analysis->dbID, scalar(@$actual_batch));
my $jobs_done_by_this_batch = $self->run_one_batch( $actual_batch );
$jobs_done_by_batches_loop += $jobs_done_by_this_batch;
$self->job_limiter->final_decision( $jobs_done_by_this_batch );
......
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