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

[re]specialization message split into two halves, to wrap around the decision making log

parent ba49fd68
No related branches found
No related tags found
No related merge requests found
...@@ -139,6 +139,12 @@ sub suggest_analysis_to_specialize_a_worker { ...@@ -139,6 +139,12 @@ sub suggest_analysis_to_specialize_a_worker {
my ($workers_to_submit_by_analysis, $workers_to_submit_by_meadow_type_rc_name, $total_extra_workers_required, $log_buffer) my ($workers_to_submit_by_analysis, $workers_to_submit_by_meadow_type_rc_name, $total_extra_workers_required, $log_buffer)
= schedule_workers( $queen, 1, $worker_meadow_type, \@list_of_analyses ); = schedule_workers( $queen, 1, $worker_meadow_type, \@list_of_analyses );
if( $worker->debug ) {
foreach my $msg (@$log_buffer) {
$worker->worker_say( $msg );
}
}
# take the first analysis from the "plan" if the "plan" was not empty: # take the first analysis from the "plan" if the "plan" was not empty:
return scalar(@$workers_to_submit_by_analysis) && $workers_to_submit_by_analysis->[0][0]; return scalar(@$workers_to_submit_by_analysis) && $workers_to_submit_by_analysis->[0][0];
} }
......
...@@ -205,9 +205,19 @@ sub log_dir { ...@@ -205,9 +205,19 @@ sub log_dir {
## Non-Storable attributes: ## Non-Storable attributes:
sub current_role { sub current_role {
my $self = shift; my $self = shift;
$self->{'_current_role'} = shift if(@_);
return $self->{'_current_role'}; if( @_ ) {
if( my $from_analysis = $self->{'_current_role'} && $self->{'_current_role'}->analysis ) {
$self->worker_say( "unspecializing from ".$from_analysis->logic_name.'('.$from_analysis->dbID.')' );
}
my $new_role = shift @_;
if( my $to_analysis = $new_role && $new_role->analysis ) {
$self->worker_say( "specializing to ".$to_analysis->logic_name.'('.$to_analysis->dbID.')' );
}
$self->{'_current_role'} = $new_role;
}
return $self->{'_current_role'};
} }
...@@ -529,6 +539,7 @@ sub run { ...@@ -529,6 +539,7 @@ sub run {
if( $cod =~ /^(NO_WORK|HIVE_OVERLOAD)$/ and $self->can_respecialize and (!$specialization_arghash or $specialization_arghash->{'-analyses_pattern'}!~/^\w+$/) ) { if( $cod =~ /^(NO_WORK|HIVE_OVERLOAD)$/ and $self->can_respecialize and (!$specialization_arghash or $specialization_arghash->{'-analyses_pattern'}!~/^\w+$/) ) {
my $old_role = $self->current_role; my $old_role = $self->current_role;
$self->adaptor->db->get_RoleAdaptor->finalize_role( $old_role, 1 ); $self->adaptor->db->get_RoleAdaptor->finalize_role( $old_role, 1 );
$self->current_role( undef );
$self->cause_of_death(undef); $self->cause_of_death(undef);
$self->specialize_and_compile_wrapper( $specialization_arghash, $old_role->analysis ); $self->specialize_and_compile_wrapper( $specialization_arghash, $old_role->analysis );
} }
...@@ -564,22 +575,11 @@ sub specialize_and_compile_wrapper { ...@@ -564,22 +575,11 @@ sub specialize_and_compile_wrapper {
eval { eval {
$self->enter_status('SPECIALIZATION'); $self->enter_status('SPECIALIZATION');
$self->adaptor->specialize_worker( $self, $specialization_arghash ); $self->adaptor->specialize_worker( $self, $specialization_arghash );
my $new_role = $self->current_role();
my $specialization_to = $new_role->analysis->logic_name.'('.$new_role->analysis_id.')';
if( $prev_analysis ) {
my $respecialization_from = $prev_analysis && $prev_analysis->logic_name.'('.$prev_analysis->dbID.')';
$self->worker_say( "respecializing from $respecialization_from to $specialization_to" );
} else {
$self->worker_say( "specializing to $specialization_to" );
}
1; 1;
} or do { } or do {
my $msg = $@; my $msg = $@;
chomp $msg; chomp $msg;
$self->worker_say( "[re]specialization failed:\t$msg" ); $self->worker_say( "specialization failed:\t$msg" );
$self->adaptor->db->get_LogMessageAdaptor()->store_worker_message($self, $msg, 1 ); $self->adaptor->db->get_LogMessageAdaptor()->store_worker_message($self, $msg, 1 );
$self->cause_of_death('SEE_MSG') unless($self->cause_of_death()); # some specific causes could have been set prior to die "..."; $self->cause_of_death('SEE_MSG') unless($self->cause_of_death()); # some specific causes could have been set prior to die "...";
......
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