Commit 90513b84 authored by Leo Gordon's avatar Leo Gordon
Browse files

moved Q:get_workers_rank --> RA:get_role_rank

parent fef64ef9
......@@ -95,10 +95,17 @@ sub get_hive_current_load {
}
sub get_role_rank {
my ($self, $role) = @_;
return $self->count_all( 'analysis_id=' . $role->analysis_id . ' AND when_finished IS NULL AND role_id<' . $role->dbID );
}
sub count_active_roles {
my ($self, $analysis_id) = @_;
return $self->count_all( "when_finished IS NULL".($analysis_id ? " AND analysis_id=$analysis_id" : '') );
return $self->count_all( ($analysis_id ? "analysis_id=$analysis_id AND " : '') . 'when_finished IS NULL' );
}
......
......@@ -667,13 +667,6 @@ sub get_num_failed_analyses {
}
sub get_workers_rank {
my ($self, $worker) = @_;
return $self->count_all( "status!='DEAD' AND analysis_id=" . $worker->current_role->analysis_id . " AND worker_id<" . $worker->dbID );
}
sub get_remaining_jobs_show_hive_progress {
my $self = shift;
my $sql = "SELECT sum(done_job_count), sum(failed_job_count), sum(total_job_count), ".
......
......@@ -509,11 +509,12 @@ sub run {
$self->cause_of_death('LIFESPAN');
} else {
my $desired_batch_size = $self->current_role->analysis->stats->get_or_estimate_batch_size();
my $current_role = $self->current_role;
my $desired_batch_size = $current_role->analysis->stats->get_or_estimate_batch_size();
$desired_batch_size = $self->job_limiter->preliminary_offer( $desired_batch_size );
my $workers_rank = $self->adaptor->get_workers_rank( $self );
my $actual_batch = $job_adaptor->grab_jobs_for_worker( $self, $desired_batch_size, $workers_rank );
my $role_rank = $self->adaptor->db->get_RoleAdaptor->get_role_rank( $current_role );
my $actual_batch = $job_adaptor->grab_jobs_for_worker( $self, $desired_batch_size, $role_rank );
if(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;
......
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