Commit 82f2ceab authored by Leo Gordon's avatar Leo Gordon
Browse files

schema_change: remove the 'monitor' table in favour of generate_timeline.pl script

parent fcab2f08
......@@ -727,41 +727,6 @@ sub print_running_worker_counts {
}
=head2 monitor
Arg[1] : --none--
Example : $queen->monitor();
Description: Monitors current throughput and store the result in the monitor
table
Exceptions : none
Caller : beekeepers and other external processes
=cut
sub monitor {
my $self = shift;
my $sql = qq{
INSERT INTO monitor
SELECT CURRENT_TIMESTAMP, count(*),
} . {
'mysql' => qq{ sum(work_done/(UNIX_TIMESTAMP()-UNIX_TIMESTAMP(born))),
sum(work_done/(UNIX_TIMESTAMP()-UNIX_TIMESTAMP(born)))/count(*), },
'sqlite' => qq{ sum(work_done/(strftime('%s','now')-strftime('%s',born))),
sum(work_done/(strftime('%s','now')-strftime('%s',born)))/count(*), },
'pgsql' => qq{ sum(work_done/(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - born))),
sum(work_done/(EXTRACT(EPOCH FROM CURRENT_TIMESTAMP - born)))/count(*), },
}->{ $self->dbc->driver }. qq{
group_concat(DISTINCT logic_name)
FROM worker w
LEFT JOIN analysis_base USING (analysis_id)
WHERE w.status!='DEAD'
};
my $sth = $self->prepare($sql);
$sth->execute();
}
=head2 register_all_workers_dead
Example : $queen->register_all_workers_dead();
......
......@@ -94,7 +94,7 @@ sub fetch_input {
$self->param('ignores', \@ignores);
# Would be good to have this from eHive
my @ehive_tables = qw(hive_meta pipeline_wide_parameters worker dataflow_rule analysis_base analysis_ctrl_rule job accu log_message job_file analysis_data resource_description analysis_stats analysis_stats_monitor monitor msg progress resource_class);
my @ehive_tables = qw(hive_meta pipeline_wide_parameters worker dataflow_rule analysis_base analysis_ctrl_rule job accu log_message job_file analysis_data resource_description analysis_stats analysis_stats_monitor msg progress resource_class);
$self->param('nb_ehive_tables', scalar(@ehive_tables));
# Connection parameters
......
......@@ -122,7 +122,6 @@ sub main {
'reset_failed|reset_failed_jobs_for_analysis=s' => \$reset_failed_jobs_for_analysis,
'reset_all|reset_all_jobs_for_analysis=s' => \$reset_all_jobs_for_analysis,
'job_output=i' => \$job_id_for_output,
'monitor!' => \$self->{'monitor'},
);
if ($help) { script_usage(0); }
......@@ -140,9 +139,6 @@ sub main {
unless($max_loops) {
$max_loops = -1; # unlimited
}
unless(defined($self->{'monitor'})) {
$self->{'monitor'} = 1;
}
}
if($self->{'url'} or $self->{'reg_alias'}) {
......@@ -285,10 +281,6 @@ sub main {
}
}
if ($self->{'monitor'}) {
$queen->monitor();
}
exit(0);
}
......@@ -348,7 +340,6 @@ sub run_autonomously {
my $failed_analyses=0;
do {
if($iteration++) {
$queen->monitor();
$self->{'dba'}->dbc->disconnect_if_idle;
printf("sleep %.2f minutes. Next loop at %s\n", $self->{'sleep_minutes'}, scalar localtime(time+$self->{'sleep_minutes'}*60));
sleep($self->{'sleep_minutes'}*60);
......
-- remove the 'monitor' table (it has been replaced by generate_timeline.pl)
DROP TABLE monitor;
-- UPDATE hive_sql_schema_version
UPDATE hive_meta SET meta_value=58 WHERE meta_key='hive_sql_schema_version' AND meta_value='57';
-- remove the 'monitor' table (it has been replaced by generate_timeline.pl)
DROP TABLE monitor;
-- UPDATE hive_sql_schema_version
UPDATE hive_meta SET meta_value=58 WHERE meta_key='hive_sql_schema_version' AND meta_value='57';
-- remove the 'monitor' table (it has been replaced by generate_timeline.pl)
DROP TABLE monitor;
-- UPDATE hive_sql_schema_version
UPDATE hive_meta SET meta_value=58 WHERE meta_key='hive_sql_schema_version' AND meta_value='57';
......@@ -128,7 +128,7 @@ CREATE PROCEDURE drop_hive_tables()
MODIFIES SQL DATA
BEGIN
DROP VIEW IF EXISTS msg, progress;
DROP TABLE IF EXISTS pipeline_wide_parameters, monitor, analysis_stats_monitor, resource_description, analysis_data, job_file, dataflow_rule, analysis_ctrl_rule, analysis_stats, log_message, accu, job, worker, analysis_base, resource_class, hive_meta;
DROP TABLE IF EXISTS pipeline_wide_parameters, analysis_stats_monitor, resource_description, analysis_data, job_file, dataflow_rule, analysis_ctrl_rule, analysis_stats, log_message, accu, job, worker, analysis_base, resource_class, hive_meta;
END; //
DELIMITER ;
......@@ -578,29 +578,3 @@ CREATE TABLE analysis_stats_monitor (
) COLLATE=latin1_swedish_ci ENGINE=InnoDB;
/**
@table monitor
@colour #F4D20C
@desc A regular collated snapshot of the Worker table.
@column time when this snapshot was taken
@column workers number of running workers
@column throughput average numb of completed Jobs per sec. of the hive (this number is calculated using running workers only)
@column per_worker average numb of completed Jobs per sec. per Worker (this number is calculated using running workers only)
@column analysis a comma-separated list of analyses running at the time of snapshot
*/
CREATE TABLE monitor (
time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
workers INTEGER NOT NULL DEFAULT 0,
throughput FLOAT DEFAULT NULL,
per_worker FLOAT DEFAULT NULL,
analysis TEXT DEFAULT NULL -- not just one, but a list of logic_names
) COLLATE=latin1_swedish_ci ENGINE=InnoDB;
......@@ -582,29 +582,3 @@ CREATE TABLE analysis_stats_monitor (
);
/**
@table monitor
@colour #F4D20C
@desc A regular collated snapshot of the Worker table.
@column time when this snapshot was taken
@column workers number of running workers
@column throughput average numb of completed Jobs per sec. of the hive (this number is calculated using running workers only)
@column per_worker average numb of completed Jobs per sec. per Worker (this number is calculated using running workers only)
@column analysis a comma-separated list of analyses running at the time of snapshot
*/
CREATE TABLE monitor (
time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
workers INTEGER NOT NULL DEFAULT 0,
throughput FLOAT DEFAULT NULL,
per_worker FLOAT DEFAULT NULL,
analysis TEXT DEFAULT NULL -- not just one, but a list of logic_names
);
......@@ -569,29 +569,3 @@ CREATE TABLE analysis_stats_monitor (
sync_lock SMALLINT NOT NULL DEFAULT 0
);
/**
@table monitor
@colour #F4D20C
@desc A regular collated snapshot of the Worker table.
@column time when this snapshot was taken
@column workers number of running workers
@column throughput average numb of completed Jobs per sec. of the hive (this number is calculated using running workers only)
@column per_worker average numb of completed Jobs per sec. per Worker (this number is calculated using running workers only)
@column analysis a comma-separated list of analyses running at the time of snapshot
*/
CREATE TABLE monitor (
time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
workers INTEGER NOT NULL DEFAULT 0,
throughput FLOAT DEFAULT NULL,
per_worker FLOAT DEFAULT NULL,
analysis TEXT DEFAULT NULL -- not just one, but a list of logic_names
);
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