Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -53,10 +53,12 @@ package Bio::EnsEMBL::Hive::Utils; ...@@ -53,10 +53,12 @@ package Bio::EnsEMBL::Hive::Utils;
use strict; use strict;
use warnings; use warnings;
use Data::Dumper; use Data::Dumper;
use Bio::EnsEMBL::Hive::Version;
use Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor;
use Bio::EnsEMBL::Hive::DBSQL::DBConnection; use Bio::EnsEMBL::Hive::DBSQL::DBConnection;
use Exporter 'import'; 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 =head2 stringify
...@@ -323,5 +325,11 @@ sub go_figure_dbc { ...@@ -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; 1;
...@@ -14,7 +14,7 @@ BEGIN { ...@@ -14,7 +14,7 @@ BEGIN {
use Getopt::Long; use Getopt::Long;
use File::Path 'make_path'; 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::Utils::Config;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor; use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Queen; use Bio::EnsEMBL::Hive::Queen;
...@@ -33,7 +33,8 @@ sub main { ...@@ -33,7 +33,8 @@ sub main {
# the globals into a nice '$self' package # the globals into a nice '$self' package
my $self = {}; my $self = {};
my $help; my $help = 0;
my $report_versions = 0;
my $loopit = 0; my $loopit = 0;
my $sync = 0; my $sync = 0;
my $local = 0; my $local = 0;
...@@ -108,11 +109,12 @@ sub main { ...@@ -108,11 +109,12 @@ sub main {
'submit_log_dir=s' => \$self->{'submit_log_dir'}, 'submit_log_dir=s' => \$self->{'submit_log_dir'},
# other commands/options # other commands/options
'h|help' => \$help, 'h|help!' => \$help,
'sync' => \$sync, 'v|versions!' => \$report_versions,
'dead' => \$check_for_dead, 'sync!' => \$sync,
'dead!' => \$check_for_dead,
'killworker=i' => \$kill_worker_id, 'killworker=i' => \$kill_worker_id,
'alldead' => \$all_dead, 'alldead!' => \$all_dead,
'balance_semaphores'=> \$balance_semaphores, 'balance_semaphores'=> \$balance_semaphores,
'no_analysis_stats' => \$self->{'no_analysis_stats'}, 'no_analysis_stats' => \$self->{'no_analysis_stats'},
'worker_stats' => \$show_worker_stats, 'worker_stats' => \$show_worker_stats,
...@@ -126,6 +128,11 @@ sub main { ...@@ -126,6 +128,11 @@ sub main {
if ($help) { script_usage(0); } 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 my $config = Bio::EnsEMBL::Hive::Utils::Config->new(); # will probably add a config_file option later
if($run or $run_job_id) { if($run or $run_job_id) {
...@@ -491,6 +498,7 @@ __DATA__ ...@@ -491,6 +498,7 @@ __DATA__
=head2 Other commands/options =head2 Other commands/options
-help : print this help -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 -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!) -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) -balance_semaphores : set all semaphore_counts to the numbers of unDONE fan jobs (emergency use only)
......
...@@ -14,11 +14,11 @@ BEGIN { ...@@ -14,11 +14,11 @@ BEGIN {
use Getopt::Long; use Getopt::Long;
use Bio::EnsEMBL::Registry; use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::Utils::URL; use Bio::EnsEMBL::Hive::Utils::URL;
use Bio::EnsEMBL::Hive::Utils ('script_usage'); use Bio::EnsEMBL::Hive::Utils ('script_usage', 'report_versions');
sub main { 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( GetOptions(
# connect to the database: # connect to the database:
...@@ -34,13 +34,20 @@ sub main { ...@@ -34,13 +34,20 @@ sub main {
'verbose!' => \$verbose, 'verbose!' => \$verbose,
'help!' => \$help, 'help!' => \$help,
'v|versions!' => \$report_versions,
); );
my $dbc_hash; my $dbc_hash;
if($help) { if($help) {
script_usage(0); script_usage(0);
} elsif($report_versions) {
report_versions();
exit(0);
} elsif($reg_alias) { } elsif($reg_alias) {
script_usage(1) if $url; script_usage(1) if $url;
Bio::EnsEMBL::Registry->load_all($reg_conf); Bio::EnsEMBL::Registry->load_all($reg_conf);
......
...@@ -13,7 +13,7 @@ BEGIN { ...@@ -13,7 +13,7 @@ BEGIN {
use Getopt::Long; 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::Registry;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor; use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Queen; use Bio::EnsEMBL::Hive::Queen;
...@@ -24,7 +24,7 @@ Bio::EnsEMBL::Registry->no_version_check(1); ...@@ -24,7 +24,7 @@ Bio::EnsEMBL::Registry->no_version_check(1);
my ($url, $reg_conf, $reg_type, $reg_alias, $nosqlvc); # Connection parameters 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 ($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 ($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( GetOptions(
...@@ -55,11 +55,18 @@ GetOptions( ...@@ -55,11 +55,18 @@ GetOptions(
# Other commands # Other commands
'h|help' => \$help, 'h|help' => \$help,
'v|versions' => \$report_versions,
'debug=i' => \$debug, 'debug=i' => \$debug,
); );
if ($help) { script_usage(0); } 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: 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); Bio::EnsEMBL::Registry->load_all($reg_conf);
} }
...@@ -195,6 +202,7 @@ __DATA__ ...@@ -195,6 +202,7 @@ __DATA__
=head2 Other options: =head2 Other options:
-help : print this help -help : print this help
-versions : report both Hive code version and Hive database schema version
-debug <level> : turn on debug messages at <level> -debug <level> : turn on debug messages at <level>
-analysis_stats : show status of each analysis in hive -analysis_stats : show status of each analysis in hive
......
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