Commit 611790a2 authored by Leo Gordon's avatar Leo Gordon
Browse files

The main scripts now report code and DB schema versions via calling a centralized Utils method

parent ef236a47
......@@ -53,10 +53,12 @@ package Bio::EnsEMBL::Hive::Utils;
use strict;
use warnings;
use Data::Dumper;
use Bio::EnsEMBL::Hive::Version;
use Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor;
use Bio::EnsEMBL::Hive::DBSQL::DBConnection;
use Exporter 'import';
our @EXPORT_OK = qw(stringify destringify dir_revhash parse_cmdline_options find_submodules load_file_or_module script_usage url2dbconn_hash go_figure_dbc);
our @EXPORT_OK = qw(stringify destringify dir_revhash parse_cmdline_options find_submodules load_file_or_module script_usage url2dbconn_hash go_figure_dbc report_versions);
=head2 stringify
......@@ -323,5 +325,11 @@ sub go_figure_dbc {
}
}
sub report_versions {
print "CodeVersion\t".Bio::EnsEMBL::Hive::Version->get_code_version()."\n";
print "CompatibleHiveDatabaseSchemaVersion\t".Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version()."\n";
}
1;
......@@ -14,7 +14,7 @@ BEGIN {
use Getopt::Long;
use File::Path 'make_path';
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'destringify');
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'destringify', 'report_versions');
use Bio::EnsEMBL::Hive::Utils::Config;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Queen;
......@@ -33,7 +33,8 @@ sub main {
# the globals into a nice '$self' package
my $self = {};
my $help;
my $help = 0;
my $report_versions = 0;
my $loopit = 0;
my $sync = 0;
my $local = 0;
......@@ -108,11 +109,12 @@ sub main {
'submit_log_dir=s' => \$self->{'submit_log_dir'},
# other commands/options
'h|help' => \$help,
'sync' => \$sync,
'dead' => \$check_for_dead,
'h|help!' => \$help,
'v|versions!' => \$report_versions,
'sync!' => \$sync,
'dead!' => \$check_for_dead,
'killworker=i' => \$kill_worker_id,
'alldead' => \$all_dead,
'alldead!' => \$all_dead,
'balance_semaphores'=> \$balance_semaphores,
'no_analysis_stats' => \$self->{'no_analysis_stats'},
'worker_stats' => \$show_worker_stats,
......@@ -126,6 +128,11 @@ sub main {
if ($help) { script_usage(0); }
if($report_versions) {
report_versions();
exit(0);
}
my $config = Bio::EnsEMBL::Hive::Utils::Config->new(); # will probably add a config_file option later
if($run or $run_job_id) {
......@@ -491,6 +498,7 @@ __DATA__
=head2 Other commands/options
-help : print this help
-versions : report both Hive code version and Hive database schema version
-dead : detect all unaccounted dead workers and reset their jobs for resubmission
-alldead : tell the database all workers are dead (no checks are performed in this mode, so be very careful!)
-balance_semaphores : set all semaphore_counts to the numbers of unDONE fan jobs (emergency use only)
......
......@@ -14,11 +14,11 @@ BEGIN {
use Getopt::Long;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::Utils::URL;
use Bio::EnsEMBL::Hive::Utils ('script_usage');
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'report_versions');
sub main {
my ($reg_conf, $reg_type, $reg_alias, $url, $sqlcmd, $extra, $to_params, $verbose, $help);
my ($reg_conf, $reg_type, $reg_alias, $url, $sqlcmd, $extra, $to_params, $verbose, $help, $report_versions);
GetOptions(
# connect to the database:
......@@ -34,13 +34,20 @@ sub main {
'verbose!' => \$verbose,
'help!' => \$help,
'v|versions!' => \$report_versions,
);
my $dbc_hash;
if($help) {
script_usage(0);
} elsif($report_versions) {
report_versions();
exit(0);
} elsif($reg_alias) {
script_usage(1) if $url;
Bio::EnsEMBL::Registry->load_all($reg_conf);
......
......@@ -13,7 +13,7 @@ BEGIN {
use Getopt::Long;
use Bio::EnsEMBL::Hive::Utils ('script_usage');
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'report_versions');
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Queen;
......@@ -24,7 +24,7 @@ Bio::EnsEMBL::Registry->no_version_check(1);
my ($url, $reg_conf, $reg_type, $reg_alias, $nosqlvc); # Connection parameters
my ($resource_class_id, $resource_class_name, $analysis_id, $logic_name, $job_id, $force); # Task specification parameters
my ($job_limit, $life_span, $no_cleanup, $no_write, $hive_log_dir, $worker_log_dir, $retry_throwing_jobs, $can_respecialize); # Worker control parameters
my ($help, $debug);
my ($help, $report_versions, $debug);
GetOptions(
......@@ -55,11 +55,18 @@ GetOptions(
# Other commands
'h|help' => \$help,
'v|versions' => \$report_versions,
'debug=i' => \$debug,
);
if ($help) { script_usage(0); }
if($report_versions) {
report_versions();
exit(0);
}
if($reg_conf) { # if reg_conf is defined, we load it regardless of whether it is used to connect to the Hive database or not:
Bio::EnsEMBL::Registry->load_all($reg_conf);
}
......@@ -195,6 +202,7 @@ __DATA__
=head2 Other options:
-help : print this help
-versions : report both Hive code version and Hive database schema version
-debug <level> : turn on debug messages at <level>
-analysis_stats : show status of each analysis in hive
......
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