Commit 6dd08829 authored by Leo Gordon's avatar Leo Gordon
Browse files

incompatible_change: -analysis_topup always on, -job_topup dropped in fav. of seed_pipeline.pl

parent 54cee0e3
......@@ -234,10 +234,7 @@ sub pre_options {
return {
'help!' => '',
'job_topup!' => '',
'analysis_topup!' => '',
'pipeline_url' => '',
# 'hive_use_triggers' => '',
};
}
......@@ -416,6 +413,20 @@ sub process_options {
}
sub run_pipeline_create_commands {
my $self = shift @_;
foreach my $cmd (@{$self->pipeline_create_commands}) {
warn "Running the command:\n\t$cmd\n";
if(my $retval = system($cmd)) {
die "Return value = $retval, possibly an error\n";
} else {
warn "Done.\n\n";
}
}
}
=head2 run
Description : The method that uses the Hive/EnsEMBL API to actually create all the analyses, jobs, dataflow and control rules and resource descriptions.
......@@ -426,31 +437,19 @@ sub process_options {
sub run {
my $self = shift @_;
my $analysis_topup = $self->{'_extra_options'}{'analysis_topup'};
my $job_topup = $self->{'_extra_options'}{'job_topup'};
my $pipeline_url = $self->pipeline_url();
my $pipeline_name = $self->o('pipeline_name');
unless($analysis_topup || $job_topup) {
foreach my $cmd (@{$self->pipeline_create_commands}) {
warn "Running the command:\n\t$cmd\n";
if(my $retval = system($cmd)) {
die "Return value = $retval, possibly an error\n";
} else {
warn "Done.\n\n";
}
}
}
$self->run_pipeline_create_commands(); # now do it at all times (strictly topping-up configs will have to mask pipeline_create_commands() )
my $pipeline_url = $self->pipeline_url();
my $hive_dba = Bio::EnsEMBL::Hive::DBSQL::DBAdaptor->new( -url => $pipeline_url, -no_sql_schema_version_check => 1 );
Bio::EnsEMBL::Hive->load_collections_from_dba( $hive_dba );
unless($job_topup) {
my $meta_adaptor = $hive_dba->get_MetaAdaptor; # the new adaptor for 'hive_meta' table
warn "Loading hive_meta table ...\n";
my $hive_meta_table = $self->hive_meta_table;
while( my($meta_key, $meta_value) = each %$hive_meta_table ) {
$meta_adaptor->remove_all_by_meta_key($meta_key); # make sure there previous values are gone
$meta_adaptor->store_pair( $meta_key, $meta_value );
}
......@@ -459,9 +458,7 @@ sub run {
my $pipeline_wide_parameters = $self->pipeline_wide_parameters;
while( my($meta_key, $meta_value) = each %$pipeline_wide_parameters ) {
if($analysis_topup) {
$meta_container->remove_all_by_meta_key($meta_key);
}
$meta_container->remove_all_by_meta_key($meta_key); # make sure there previous values are gone
$meta_container->store_pair($meta_key, $meta_value);
}
warn "Done.\n\n";
......@@ -517,7 +514,7 @@ sub run {
Bio::EnsEMBL::Hive->collection('ResourceClass')->add( $default_rc );
}
warn "Done.\n\n";
}
my $valley = Bio::EnsEMBL::Hive::Valley->new( {}, 'LOCAL' );
......@@ -544,17 +541,11 @@ sub run {
my $analysis = Bio::EnsEMBL::Hive->collection('Analysis')->find_one_by('logic_name', $logic_name); # the analysis with this logic_name may have already been stored in the db
if( $analysis ) {
if($analysis_topup) {
warn "Skipping creation of already existing analysis '$logic_name'.\n";
next;
}
} else {
if($job_topup) {
die "Could not find local analysis '$logic_name'";
}
warn "Creating analysis '$logic_name'.\n";
$rc_name ||= 'default';
......@@ -614,8 +605,6 @@ sub run {
}
}
unless($job_topup) {
# Now, run separately through the already created analyses and link them together:
#
foreach my $aha (@{$self->pipeline_analyses}) {
......@@ -707,9 +696,15 @@ sub run {
} # /for all heirs
} # /for all branch_tags
} # /for all pipeline_analyses
} # /unless($job_topup)
Bio::EnsEMBL::Hive->save_collections_to_dba( $hive_dba );
}
sub show_useful_commands {
my $self = shift @_;
my $pipeline_url = $self->pipeline_url();
my $pipeline_name = $self->o('pipeline_name');
print "\n\n# --------------------[Useful commands]--------------------------\n";
print "\n";
......
......@@ -18,16 +18,31 @@ BEGIN {
}
use Getopt::Long qw(:config pass_through no_auto_abbrev);
use Bio::EnsEMBL::Hive::Utils ('script_usage', 'load_file_or_module');
sub main {
my %deprecated_option = ();
GetOptions( \%deprecated_option,
'analysis_topup!', # always on
'job_topup!', # never, use seed_pipeline.pl
);
if($deprecated_option{'job_topup'}) {
die "-job_topup mode has been discontinued. Please use seed_pipeline.pl instead.\n";
}
if($deprecated_option{'analysis_topup'}) {
die "-analysis_topup has been deprecated. Please note this script now *always* runs in -analysis_topup mode.\n";
}
my $file_or_module = shift @ARGV or script_usage(0);
my $config_module = load_file_or_module( $file_or_module );
my $pipeconfig_package_name = load_file_or_module( $file_or_module );
my $config_object = $config_module->new();
$config_object->process_options();
$config_object->run();
my $pipeconfig_object = $pipeconfig_package_name->new();
$pipeconfig_object->process_options();
$pipeconfig_object->run();
$pipeconfig_object->show_useful_commands();
}
main();
......
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