Commit 7a293d7e authored by Leo Gordon's avatar Leo Gordon
Browse files

renamed 'job_message' table to 'log_message' and JobMessageAdaptor to LogMessageAdaptor everywhere

parent 2a3982de
......@@ -212,7 +212,7 @@ sub incomplete { # Job should set this to 0 prior to throwing if the
=head2 warning
Description: records a non-error message in 'job_message' table linked to the current job
Description: records a non-error message in 'log_message' table linked to the current job
=cut
......@@ -220,7 +220,7 @@ sub warning {
my ($self, $msg) = @_;
if( my $job_adaptor = $self->adaptor ) {
$job_adaptor->db->get_JobMessageAdaptor()->store_job_message($self->dbID, $msg, 0);
$job_adaptor->db->get_LogMessageAdaptor()->store_job_message($self->dbID, $msg, 0);
} else {
print STDERR "Warning: $msg\n";
}
......
......@@ -622,7 +622,7 @@ sub release_undone_jobs_from_worker {
}
}
$self->db()->get_JobMessageAdaptor()->store_job_message($job_id, $msg, not $passed_on );
$self->db()->get_LogMessageAdaptor()->store_job_message($job_id, $msg, not $passed_on );
unless($passed_on) {
$self->release_and_age_job( $job_id, $max_retry_count, not $resource_overusage );
......
......@@ -63,7 +63,7 @@ sub get_available_adaptors {
'DataflowRule' => 'Bio::EnsEMBL::Hive::DBSQL::DataflowRuleAdaptor',
'ResourceDescription' => 'Bio::EnsEMBL::Hive::DBSQL::ResourceDescriptionAdaptor',
'ResourceClass' => 'Bio::EnsEMBL::Hive::DBSQL::ResourceClassAdaptor',
'JobMessage' => 'Bio::EnsEMBL::Hive::DBSQL::JobMessageAdaptor',
'LogMessage' => 'Bio::EnsEMBL::Hive::DBSQL::LogMessageAdaptor',
'NakedTable' => 'Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor',
# "old" Hive adaptors (having their own fetching/storing code) :
......
......@@ -2,13 +2,13 @@
=head1 NAME
Bio::EnsEMBL::Hive::DBSQL::JobMessageAdaptor
Bio::EnsEMBL::Hive::DBSQL::LogMessageAdaptor
=head1 SYNOPSIS
$dba->get_JobMessageAdaptor->store_job_message($job_id, $msg, $is_error);
$dba->get_LogMessageAdaptor->store_job_message($job_id, $msg, $is_error);
$dba->get_JobMessageAdaptor->store_worker_message($worker_id, $msg, $is_error);
$dba->get_LogMessageAdaptor->store_worker_message($worker_id, $msg, $is_error);
=head1 DESCRIPTION
......@@ -21,7 +21,7 @@
=cut
package Bio::EnsEMBL::Hive::DBSQL::JobMessageAdaptor;
package Bio::EnsEMBL::Hive::DBSQL::LogMessageAdaptor;
use strict;
......@@ -29,7 +29,7 @@ use base ('Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor');
sub default_table_name {
return 'job_message';
return 'log_message';
}
......
......@@ -63,7 +63,7 @@ sub fetch_input {
$self->param('ignores', \@ignores);
# Would be good to have this from eHive
my @ehive_tables = qw(worker dataflow_rule analysis_base analysis_ctrl_rule job job_message job_file analysis_data resource_description analysis_stats analysis_stats_monitor monitor msg progress resource_class);
my @ehive_tables = qw(worker dataflow_rule analysis_base analysis_ctrl_rule job log_message job_file analysis_data resource_description analysis_stats analysis_stats_monitor monitor msg progress resource_class);
$self->param('nb_ehive_tables', scalar(@ehive_tables));
# Connection parameters
......
......@@ -91,7 +91,7 @@ sub write_output { # nothing to write out, but some dataflow to perform:
# "fan out" into branch#2 first
$self->dataflow_output_id($output_ids, 2);
$self->warning(scalar(@$output_ids).' multiplication jobs have been created'); # warning messages get recorded into 'job_message' table
$self->warning(scalar(@$output_ids).' multiplication jobs have been created'); # warning messages get recorded into 'log_message' table
# then flow into the branch#1 funnel; input_id would flow into branch#1 by default anyway, but we request it here explicitly:
$self->dataflow_output_id($self->input_id, 1);
......
......@@ -510,7 +510,7 @@ sub run {
} or do {
my $msg = $@;
warn "Could not specialize worker:\n\t$msg\n";
$self->adaptor->db->get_JobMessageAdaptor()->store_worker_message($self->dbID, $msg, 1 );
$self->adaptor->db->get_LogMessageAdaptor()->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 "...";
};
......@@ -532,7 +532,7 @@ sub run {
} or do {
my $msg = "Could not compile Runnable '".$self->analysis->module."' :\n\t".$@;
warn "$msg\n";
$self->adaptor->db->get_JobMessageAdaptor()->store_worker_message($self->dbID, $msg, 1 );
$self->adaptor->db->get_LogMessageAdaptor()->store_worker_message($self->dbID, $msg, 1 );
$self->cause_of_death('SEE_MSG');
};
......@@ -677,7 +677,7 @@ sub run_one_batch {
my $job_status_at_the_moment = $job->status();
my $action = $job->incomplete ? 'died' : 'exited';
$job_completion_line = "\njob $job_id : $action in status '$job_status_at_the_moment' for the following reason: $msg_thrown\n";
$self->adaptor->db->get_JobMessageAdaptor()->store_job_message($job_id, $msg_thrown, $job->incomplete );
$self->adaptor->db->get_LogMessageAdaptor()->store_job_message($job_id, $msg_thrown, $job->incomplete );
}
print STDERR $job_completion_line if($self->log_dir and ($self->debug or $job->incomplete)); # one copy goes to the job's STDERR
......
......@@ -8,12 +8,12 @@ ALTER TABLE analysis_stats ADD FOREIGN KEY (analysis_id)
ALTER TABLE analysis_stats_monitor ADD FOREIGN KEY (analysis_id) REFERENCES analysis_base(analysis_id);
ALTER TABLE job ADD FOREIGN KEY (worker_id) REFERENCES worker(worker_id);
ALTER TABLE job_message ADD FOREIGN KEY (worker_id) REFERENCES worker(worker_id);
ALTER TABLE log_message ADD FOREIGN KEY (worker_id) REFERENCES worker(worker_id);
ALTER TABLE job_file ADD FOREIGN KEY (worker_id) REFERENCES worker(worker_id);
ALTER TABLE job ADD FOREIGN KEY (prev_job_id) REFERENCES job(job_id);
ALTER TABLE job ADD FOREIGN KEY (semaphored_job_id) REFERENCES job(job_id);
ALTER TABLE job_message ADD FOREIGN KEY (job_id) REFERENCES job(job_id);
ALTER TABLE log_message ADD FOREIGN KEY (job_id) REFERENCES job(job_id);
ALTER TABLE job_file ADD FOREIGN KEY (job_id) REFERENCES job(job_id);
ALTER TABLE resource_description ADD FOREIGN KEY (resource_class_id) REFERENCES resource_class(resource_class_id);
......
# renaming job_message into a more generic log_message:
CREATE TABLE log_message (
log_message_id int(10) NOT NULL AUTO_INCREMENT,
job_id int(10) DEFAULT NULL,
worker_id int(10) unsigned NOT NULL,
time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
retry int(10) DEFAULT NULL,
status enum('UNKNOWN','SPECIALIZATION','COMPILATION','READY','PRE_CLEANUP','FETCH_INPUT','RUN','WRITE_OUTPUT','POST_CLEANUP','PASSED_ON') DEFAULT 'UNKNOWN',
msg text,
is_error TINYINT,
PRIMARY KEY (log_message_id),
INDEX worker_id (worker_id),
INDEX job_id (job_id)
) COLLATE=latin1_swedish_ci ENGINE=InnoDB;
INSERT INTO log_message (log_message_id, job_id, worker_id, time, retry, status, msg, is_error) SELECT * from job_message;
CREATE OR REPLACE VIEW msg AS
SELECT a.analysis_id, a.logic_name, m.*
FROM log_message m
JOIN worker w USING (worker_id)
LEFT JOIN analysis_base a ON (a.analysis_id=w.analysis_id)
LEFT JOIN job j ON (j.job_id=m.job_id);
......@@ -33,7 +33,7 @@ CREATE OR REPLACE VIEW progress AS
CREATE OR REPLACE VIEW msg AS
SELECT a.analysis_id, a.logic_name, m.*
FROM job_message m
FROM log_message m
JOIN worker w USING (worker_id)
LEFT JOIN analysis_base a ON (a.analysis_id=w.analysis_id)
LEFT JOIN job j ON (j.job_id=m.job_id);
......@@ -105,7 +105,7 @@ CREATE PROCEDURE drop_hive_tables()
MODIFIES SQL DATA
BEGIN
DROP VIEW IF EXISTS msg, progress;
DROP TABLE IF EXISTS monitor, analysis_stats_monitor, resource_description, resource_class, analysis_data, job_file, dataflow_rule, analysis_ctrl_rule, analysis_stats, job_message, job, worker;
DROP TABLE IF EXISTS monitor, analysis_stats_monitor, resource_description, resource_class, analysis_data, job_file, dataflow_rule, analysis_ctrl_rule, analysis_stats, log_message, job, worker;
END; //
DELIMITER ;
......@@ -33,7 +33,7 @@ CREATE VIEW IF NOT EXISTS progress AS
CREATE VIEW IF NOT EXISTS msg AS
SELECT a.analysis_id, a.logic_name, m.*
FROM job_message m
FROM log_message m
JOIN worker w USING (worker_id)
LEFT JOIN analysis_base a ON (a.analysis_id=w.analysis_id)
LEFT JOIN job j ON (j.job_id=m.job_id);
......
......@@ -215,14 +215,14 @@ CREATE TABLE job (
-- ---------------------------------------------------------------------------------
--
-- Table structure for table 'job_message'
-- Table structure for table 'log_message'
--
-- overview:
-- In case a job throws a message (via die/throw), this message is registered in this table.
-- It may or may not indicate that the job was unsuccessful via is_error flag.
--
-- semantics:
-- job_message_id - an autoincremented primary id of the message
-- log_message_id - an autoincremented primary id of the message
-- job_id - the id of the job that threw the message (or NULL if it was outside of a message)
-- worker_id - the 'current' worker
-- time - when the message was thrown
......@@ -231,8 +231,8 @@ CREATE TABLE job (
-- msg - string that contains the message
-- is_error - binary flag
CREATE TABLE job_message (
job_message_id int(10) NOT NULL AUTO_INCREMENT,
CREATE TABLE log_message (
log_message_id int(10) NOT NULL AUTO_INCREMENT,
job_id int(10) DEFAULT NULL,
worker_id int(10) unsigned NOT NULL,
time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
......@@ -241,7 +241,7 @@ CREATE TABLE job_message (
msg text,
is_error TINYINT,
PRIMARY KEY (job_message_id),
PRIMARY KEY (log_message_id),
INDEX worker_id (worker_id),
INDEX job_id (job_id)
......
......@@ -199,14 +199,14 @@ CREATE INDEX IF NOT EXISTS worker_idx ON job (worker_id);
-- ---------------------------------------------------------------------------------
--
-- Table structure for table 'job_message'
-- Table structure for table 'log_message'
--
-- overview:
-- In case a job throws a message (via die/throw), this message is registered in this table.
-- It may or may not indicate that the job was unsuccessful via is_error flag.
--
-- semantics:
-- job_message_id - an autoincremented primary id of the message
-- log_message_id - an autoincremented primary id of the message
-- job_id - the id of the job that threw the message (or NULL if it was outside of a message)
-- worker_id - the 'current' worker
-- time - when the message was thrown
......@@ -215,8 +215,8 @@ CREATE INDEX IF NOT EXISTS worker_idx ON job (worker_id);
-- msg - string that contains the message
-- is_error - binary flag
CREATE TABLE job_message (
job_message_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
CREATE TABLE log_message (
log_message_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
job_id INTEGER DEFAULT NULL,
worker_id INTEGER NOT NULL,
time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
......@@ -225,8 +225,8 @@ CREATE TABLE job_message (
msg TEXT,
is_error BOOLEAN
);
CREATE INDEX IF NOT EXISTS worker_idx ON job_message (worker_id);
CREATE INDEX IF NOT EXISTS job_idx ON job_message (job_id);
CREATE INDEX IF NOT EXISTS worker_idx ON log_message (worker_id);
CREATE INDEX IF NOT EXISTS job_idx ON log_message (job_id);
-- ---------------------------------------------------------------------------------
......
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