11 $dba->get_LogMessageAdaptor->store_worker_message($worker, $msg, $message_class);
13 $dba->get_LogMessageAdaptor->store_hive_message($msg, $message_class);
15 $dba->get_LogMessageAdaptor->store_beekeeper_message($beekeeper_id, $msg, $message_class, $status);
19 This is currently an
"objectless" adaptor that helps to store either warning-messages or die-messages generated by jobs
23 See the NOTICE file distributed with
this work
for additional information
24 regarding copyright ownership.
26 Licensed under the Apache License, Version 2.0 (the
"License"); you may not use
this file except in compliance with the License.
27 You may obtain a copy of the License at
31 Unless required by applicable law or agreed to in writing, software distributed under the License
32 is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 See the License
for the specific language governing permissions and limitations under the License.
37 Please subscribe to the Hive mailing list: http:
42 package Bio::EnsEMBL::Hive::DBSQL::LogMessageAdaptor;
47 use base (
'Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor');
50 sub default_table_name {
55 sub store_job_message {
56 my ($self, $job_id, $msg, $message_class) = @_;
59 chomp $msg; # we don
't want that last "\n" in the database
61 my $table_name = $self->table_name();
63 # Note: the timestamp 'when_logged
' column will be set automatically
65 INSERT INTO $table_name (job_id, role_id, worker_id, retry, status, msg, message_class)
66 SELECT job_id, role_id, worker_id, retry_count, status, ?, ?
68 JOIN role USING(role_id)
72 my $sth = $self->prepare( $sql );
73 $sth->execute( $msg, $message_class, $job_id );
77 $self->store_hive_message($msg, $message_class);
82 sub store_worker_message {
83 my ($self, $worker_or_id, $msg, $message_class) = @_;
85 my ($worker, $worker_id) = ref($worker_or_id) ? ($worker_or_id, $worker_or_id->dbID) : (undef, $worker_or_id);
86 my $role_id = $worker && $worker->current_role && $worker->current_role->dbID;
88 chomp $msg; # we don't want that last
"\n" in the database
90 my $table_name = $self->table_name();
92 # Note: the timestamp 'when_logged' column will be set automatically
94 INSERT INTO $table_name (worker_id, role_id, status, msg, message_class)
95 SELECT worker_id, ?, status, ?, ?
96 FROM worker WHERE worker_id=?
98 my $sth = $self->prepare( $sql );
99 $sth->execute( $role_id, $msg, $message_class, $worker_id );
104 sub store_hive_message {
105 my ($self, $msg, $message_class) = @_;
107 chomp $msg; # we don
't want that last "\n" in the database
109 # Note: the timestamp 'when_logged
' column will be set automatically
112 'message_class
' => $message_class,
113 'status
' => 'UNKNOWN
',
115 return $self->store($log_message);
118 sub store_beekeeper_message {
119 my ($self, $beekeeper_id, $msg, $message_class, $status) = @_;
124 'beekeeper_id
' => $beekeeper_id,
126 'message_class
' => $message_class,
129 return $self->store($log_message);
132 sub count_analysis_events {
133 my ($self, $analysis_id, $message_class) = @_;
135 return $self->count_all("JOIN role USING (role_id) WHERE analysis_id = ? AND message_class = ?", undef, $analysis_id, $message_class);