Commit 71d56412 authored by Leo Gordon's avatar Leo Gordon
Browse files

capture all "dies" during worker->run() and try to record them in log_message

parent 2368ce0e
......@@ -302,9 +302,9 @@ sub register_worker_death {
if( $current_role and !$current_role->when_finished() ) {
# List of cause_of_death:
# only happen before or after a batch: 'NO_ROLE','NO_WORK','JOB_LIMIT','HIVE_OVERLOAD','LIFESPAN', 'SEE_MSG'
# can happen whilst the worker is running a batch: 'CONTAMINATED','RELOCATED','KILLED_BY_USER','MEMLIMIT','RUNLIMIT','UNKNOWN'
my $release_undone_jobs = ($cause_of_death =~ /^(CONTAMINATED|RELOCATED|KILLED_BY_USER|MEMLIMIT|RUNLIMIT|UNKNOWN)$/);
# only happen before or after a batch: 'NO_ROLE','NO_WORK','JOB_LIMIT','HIVE_OVERLOAD','LIFESPAN','SEE_MSG'
# can happen whilst the worker is running a batch: 'CONTAMINATED','RELOCATED','KILLED_BY_USER','MEMLIMIT','RUNLIMIT','SEE_MSG','UNKNOWN'
my $release_undone_jobs = ($cause_of_death =~ /^(CONTAMINATED|RELOCATED|KILLED_BY_USER|MEMLIMIT|RUNLIMIT|SEE_MSG|UNKNOWN)$/);
$current_role->worker($worker); # So that release_undone_jobs_from_role() has the correct cause_of_death and work_done
$current_role->when_finished( $worker_died );
$self->db->get_RoleAdaptor->finalize_role( $current_role, $release_undone_jobs );
......
......@@ -138,11 +138,24 @@ sub main {
$analyses_pattern = $analysis_id;
}
$worker->run( {
-analyses_pattern => $analyses_pattern,
-job_id => $job_id,
-force => $force,
} );
eval {
$worker->run( {
-analyses_pattern => $analyses_pattern,
-job_id => $job_id,
-force => $force,
} );
1;
} or do {
my $msg = $@;
$hive_dba->get_LogMessageAdaptor()->store_worker_message($worker, $msg, 1 );
$worker->cause_of_death( 'SEE_MSG' );
$queen->register_worker_death($worker, 1);
die $msg;
};
}
......
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