From ade5f4271d2fce0a4f8d67f67b162857179f7a50 Mon Sep 17 00:00:00 2001 From: Leo Gordon <lg4@ebi.ac.uk> Date: Thu, 22 Nov 2012 17:21:22 +0000 Subject: [PATCH] Introduced a new 'NO_ROLE' cause_of_death for failures during specialization (not so much of an error, really!) --- modules/Bio/EnsEMBL/Hive/Queen.pm | 11 ++++++----- modules/Bio/EnsEMBL/Hive/Worker.pm | 4 ++-- sql/patch_2012-11-22.sql | 3 +++ sql/tables.sql | 2 +- sql/tables.sqlite | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 sql/patch_2012-11-22.sql diff --git a/modules/Bio/EnsEMBL/Hive/Queen.pm b/modules/Bio/EnsEMBL/Hive/Queen.pm index 1328c3306..32bc9de7e 100644 --- a/modules/Bio/EnsEMBL/Hive/Queen.pm +++ b/modules/Bio/EnsEMBL/Hive/Queen.pm @@ -254,15 +254,15 @@ sub specialize_new_worker { die "Analysis is DONE, and doesn't require workers"; } } - - } else { # probably scheduled by beekeeper.pl - - $stats = $self->suggest_analysis_to_specialize_by_rc_id_meadow_type($worker->resource_class_id, $worker->meadow_type) - or die "Queen failed to pick an analysis for the worker"; + # probably scheduled by beekeeper.pl: + } elsif( $stats = $self->suggest_analysis_to_specialize_by_rc_id_meadow_type($worker->resource_class_id, $worker->meadow_type) ) { print "Queen picked analysis with dbID=".$stats->analysis_id." for the worker\n"; $analysis_id = $stats->analysis_id; + } else { + $worker->cause_of_death('NO_ROLE'); + die "No analysis suitable for the worker was found\n"; } # now set it in the $worker: @@ -323,6 +323,7 @@ sub register_worker_death { or $cod eq 'RUNLIMIT' or $cod eq 'KILLED_BY_USER' or $cod eq 'SEE_MSG' + or $cod eq 'NO_ROLE' or $cod eq 'CONTAMINATED') { $self->db->get_AnalysisJobAdaptor->release_undone_jobs_from_worker($worker); } diff --git a/modules/Bio/EnsEMBL/Hive/Worker.pm b/modules/Bio/EnsEMBL/Hive/Worker.pm index 08634df11..a88229ce2 100644 --- a/modules/Bio/EnsEMBL/Hive/Worker.pm +++ b/modules/Bio/EnsEMBL/Hive/Worker.pm @@ -523,8 +523,8 @@ sub run { $min_batch_time = $self->analysis->stats->min_batch_time(); 1; } or do { - my $msg = "Could not specialize worker:\n\t".$@; - warn "$msg\n"; + my $msg = $@; + warn "Could not specialize worker:\n\t$msg\n"; $self->adaptor->db->get_JobMessageAdaptor()->store_worker_message($self->dbID, $msg, 1 ); $self->cause_of_death('SEE_MSG') unless($self->cause_of_death()); # some specific causes could have been set prior to die "..."; diff --git a/sql/patch_2012-11-22.sql b/sql/patch_2012-11-22.sql new file mode 100644 index 000000000..7e8dc87f2 --- /dev/null +++ b/sql/patch_2012-11-22.sql @@ -0,0 +1,3 @@ + # add 'NO_ROLE' cause_of_death specifically for workers that could not specialize +ALTER TABLE worker MODIFY COLUMN cause_of_death enum('NO_ROLE', 'NO_WORK', 'JOB_LIMIT', 'HIVE_OVERLOAD', 'LIFESPAN', 'CONTAMINATED', 'KILLED_BY_USER', 'MEMLIMIT', 'RUNLIMIT', 'SEE_MSG', 'UNKNOWN') DEFAULT NULL; + diff --git a/sql/tables.sql b/sql/tables.sql index 5c8a04d18..7503f2e18 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -85,7 +85,7 @@ CREATE TABLE worker ( born timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, last_check_in datetime NOT NULL, died datetime DEFAULT NULL, - cause_of_death enum('NO_WORK', 'JOB_LIMIT', 'HIVE_OVERLOAD', 'LIFESPAN', 'CONTAMINATED', 'KILLED_BY_USER', 'MEMLIMIT', 'RUNLIMIT', 'SEE_MSG', 'UNKNOWN') DEFAULT NULL, + cause_of_death enum('NO_ROLE', 'NO_WORK', 'JOB_LIMIT', 'HIVE_OVERLOAD', 'LIFESPAN', 'CONTAMINATED', 'KILLED_BY_USER', 'MEMLIMIT', 'RUNLIMIT', 'SEE_MSG', 'UNKNOWN') DEFAULT NULL, log_dir varchar(255) DEFAULT NULL, PRIMARY KEY (worker_id), diff --git a/sql/tables.sqlite b/sql/tables.sqlite index eda95f048..813a391ac 100644 --- a/sql/tables.sqlite +++ b/sql/tables.sqlite @@ -77,7 +77,7 @@ CREATE TABLE worker ( born timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, last_check_in datetime NOT NULL, died datetime DEFAULT NULL, - cause_of_death TEXT DEFAULT NULL, /* enum('NO_WORK', 'JOB_LIMIT', 'HIVE_OVERLOAD', 'LIFESPAN', 'CONTAMINATED', 'KILLED_BY_USER', 'MEMLIMIT', 'RUNLIMIT', 'SEE_MSG', 'UNKNOWN') DEFAULT NULL */ + cause_of_death TEXT DEFAULT NULL, /* enum('NO_ROLE', 'NO_WORK', 'JOB_LIMIT', 'HIVE_OVERLOAD', 'LIFESPAN', 'CONTAMINATED', 'KILLED_BY_USER', 'MEMLIMIT', 'RUNLIMIT', 'SEE_MSG', 'UNKNOWN') DEFAULT NULL */ log_dir varchar(80) DEFAULT NULL ); -- GitLab