Commit a1c0cf78 authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

Got rid of get_hive_db_meta_key() because it is redundant with HivePipeline attributes

parent 9a42273b
......@@ -53,7 +53,7 @@ my $dbConn = $pipeline->hive_dba;
eval {
my $graph = formAnalyses($pipeline);
if ($graph) {
my $html = formResponse($pipeline->hive_dba);
my $html = formResponse($pipeline);
$response->out_msg({"graph" => $graph, "html" => $html});
} else {
$response->err_msg('GraphViz failed to generate a diagram');
......@@ -68,7 +68,10 @@ if ($@) {
print $response->toJSON();
sub formResponse {
my ($dba) = @_;
my ($hive_pipeline) = @_;
my $dba = $hive_pipeline->hive_dba;
my $info;
$info->{db_name} = $dba->dbc->dbname;
......@@ -76,11 +79,11 @@ sub formResponse {
$info->{port} = $dba->dbc->port;
$info->{driver} = $dba->dbc->driver;
$info->{username} = $dba->dbc->username;
$info->{hive_db_version} = get_hive_db_meta_key($dba, 'hive_sql_schema_version');
$info->{hive_db_version} = $hive_pipeline->hive_sql_schema_version();
$info->{hive_code_version} = get_hive_code_version();
$info->{pipeline_name} = get_hive_db_meta_key($dba, 'hive_pipeline_name');
$info->{hive_auto_rebalance_semaphores} = get_hive_db_meta_key($dba, 'hive_auto_rebalance_semaphores') ? 'Enabled' : 'Disabled';
$info->{hive_use_param_stack} = get_hive_db_meta_key($dba, 'hive_use_param_stack') ? 'Enabled' : 'Disabled';
$info->{pipeline_name} = $hive_pipeline->hive_pipeline_name();
$info->{hive_auto_rebalance_semaphores} = $hive_pipeline->hive_auto_rebalance_semaphores() ? 'Enabled' : 'Disabled';
$info->{hive_use_param_stack} = $hive_pipeline->hive_use_param_stack() ? 'Enabled' : 'Disabled';
my $template = HTML::Template->new(filename => $connection_template);
$template->param(%$info);
......
......@@ -66,7 +66,7 @@ sub formResponse {
$info->{port} = $dba->dbc->port;
$info->{driver} = $dba->dbc->driver;
$info->{username} = $dba->dbc->username;
$info->{hive_db_version} = get_hive_db_meta_key('hive_sql_schema_version');
$info->{hive_db_version} = $pipeline->hive_sql_schema_version();
$info->{hive_code_version} = get_hive_code_version();
# $info->{mysql_url} = "?username=" . $dba->dbc->username . "&host=" . $dba->dbc->host . "&dbname=" . $dba->dbc->dbname . "&port=" . $dba->dbc->port;
......
......@@ -32,20 +32,12 @@ use msg;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(get_hive_code_version get_hive_db_meta_key check_db_versions_match);
@EXPORT = qw(get_hive_code_version check_db_versions_match);
sub get_hive_code_version {
return Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version();
}
sub get_hive_db_meta_key {
my ($dbConn, $key_name) = @_;
my $metaAdaptor = $dbConn->get_MetaAdaptor;
my $val;
$val = eval { $metaAdaptor->fetch_by_meta_key( $key_name )->{'meta_value'}; };
return $val;
}
sub _fail_with_status_message {
my ($status, $message) = @_;
my $response = msg->new();
......@@ -79,7 +71,7 @@ sub check_db_versions_match {
my $code_version = $version || get_hive_code_version();
my $hive_db_version;
eval {
$hive_db_version = get_hive_db_meta_key($pipeline->hive_dba, 'hive_sql_schema_version');
$hive_db_version = $pipeline->hive_sql_schema_version();
};
if ($@) {
exit(0) if $silent;
......
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