Commit a8a2fe1a authored by Leo Gordon's avatar Leo Gordon
Browse files

All Hive scripts now detect $::hive_root_dir and use it for setting the @INC...

All Hive scripts now detect $::hive_root_dir and use it for setting the @INC so manual setting of PERL5LIB is only needed if using API directly
parent 9de1dd12
......@@ -11,7 +11,7 @@ Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf
init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf -password <mypass>
# Example 2: specifying the mandatory options as well as overriding some defaults:
init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf -hive_root_dir ~/ensembl_main/ensembl-hive-new -pipeline_db -host <myhost> -pipeline_db -dbname <mydbname> -password <mypass>
init_pipeline.pl Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf -pipeline_db -host <myhost> -pipeline_db -dbname <mydbname> -password <mypass>
=head1 DESCRIPTION
......@@ -73,9 +73,10 @@ use base ('Bio::EnsEMBL::Hive::DependentOptions');
sub default_options {
my ($self) = @_;
return {
'ensembl_cvs_root_dir' => $self->o('ENV', 'ENSEMBL_CVS_ROOT_DIR'), # it will make sense to set this variable if you are going to use ehive frequently
'hive_root_dir' => $self->o('ensembl_cvs_root_dir').'/ensembl-hive', # but you may want to have Hive elsewhere, which is perfectly legitimate
'password' => $self->o('ENV', 'ENSADMIN_PSW'), # people will have to make an effort NOT to insert it into config files like .bashrc etc
'ensembl_cvs_root_dir' => $self->o('ENV', 'ENSEMBL_CVS_ROOT_DIR'), # it will make sense to set this variable if you are going to use ehive with ensembl
'hive_root_dir' => $::hive_root_dir # this value is set up automatically if this code is run by init_pipeline.pl
|| $self->o('ENV', 'ENSEMBL_CVS_ROOT_DIR').'/ensembl-hive', # otherwise we have to rely on other means
'password' => $self->o('ENV', 'ENSADMIN_PSW'), # people will have to make an effort NOT to insert it into config files like .bashrc etc
'host' => 'localhost',
'pipeline_name' => 'hive_generic',
......
......@@ -2,11 +2,17 @@
use strict;
use warnings;
use Getopt::Long;
use Cwd 'abs_path'; # both are needed to pick 'our' runWorker.pl
use File::Basename 'dirname'; #
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long;
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'destringify');
use Bio::EnsEMBL::Hive::Utils::Config;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
......@@ -275,8 +281,7 @@ sub main {
sub generate_worker_cmd {
my ($self, $run_analysis, $run_job_id, $force) = @_;
my $beekeeper_fullpath = abs_path($0);
my $worker_cmd = dirname($beekeeper_fullpath).'/runWorker.pl';
my $worker_cmd = "$::hive_root_dir/scripts/runWorker.pl";
unless(-x $worker_cmd) {
print("Can't run '$worker_cmd' script for some reason, please investigate.\n");
......
......@@ -5,6 +5,16 @@ package Script;
use strict;
use warnings;
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long;
use Pod::Usage;
......
......@@ -2,8 +2,17 @@
use strict;
use warnings;
use Getopt::Long;
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::DBSQL::AnalysisJobAdaptor;
......
#!/usr/bin/env perl
#
# A generic loader of hive pipelines.
#
# Because all of the functionality is hidden in Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf
......@@ -8,8 +8,18 @@
use strict;
use warnings;
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
sub main {
my $file_or_module = shift @ARGV or script_usage(0);
......
......@@ -4,8 +4,17 @@
use strict;
use warnings;
use Getopt::Long;
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::Utils ('script_usage');
......
......@@ -2,6 +2,16 @@
use strict;
use warnings;
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long;
use Bio::EnsEMBL::Hive::Utils ('script_usage');
use Bio::EnsEMBL::Registry;
......
......@@ -2,8 +2,17 @@
use strict;
use warnings;
use Getopt::Long;
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Hive::DBSQL::AnalysisJobAdaptor;
......
......@@ -2,14 +2,22 @@
use strict;
use warnings;
# Finding out own path in order to reference own components (including own modules):
use Cwd ();
use File::Basename ();
our $hive_root_dir;
BEGIN {
$hive_root_dir = File::Basename::dirname( File::Basename::dirname( Cwd::realpath($0) ) );
unshift @INC, "$hive_root_dir/modules";
}
use Getopt::Long qw(:config pass_through);
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Hive::Process;
use Bio::EnsEMBL::Hive::AnalysisJob;
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module', 'parse_cmdline_options', 'stringify', 'destringify');
use Data::Dumper;
my ($reg_conf, $help, $debug, $no_write, $no_cleanup, $flow_into, $input_id);
my $module_or_file = shift @ARGV or script_usage();
......
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