Skip to content

Commit

Permalink
bugfix: back to supporting -pipeline_name , making sure it gets post-…
Browse files Browse the repository at this point in the history
…processed
  • Loading branch information
ens-lg4 committed Dec 15, 2016
1 parent 09acf0e commit 8dd0f4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion modules/Bio/EnsEMBL/Hive/PipeConfig/EnsemblGeneric_conf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ sub default_options {
'rel_suffix' => '', # an empty string by default, a letter otherwise
'rel_with_suffix' => $self->o('ensembl_release').$self->o('rel_suffix'),

'pipeline_name' => $self->processed_pipeline_name().'_'.$self->o('rel_with_suffix'),
'pipeline_name' => $self->default_pipeline_name().'_'.$self->o('rel_with_suffix'),

'user' => $ENV{'EHIVE_USER'} || 'ensadmin',
'password' => $ENV{'EHIVE_PASS'} // $ENV{'ENSADMIN_PSW'} // $self->o('password'), # people will have to make an effort NOT to insert it into config files like .bashrc etc
Expand Down
34 changes: 17 additions & 17 deletions modules/Bio/EnsEMBL/Hive/PipeConfig/HiveGeneric_conf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ sub default_options {
'hive_force_init' => 0, # setting it to 1 will drop the database prior to creation (use with care!)
'hive_no_init' => 0, # setting it to 1 will skip pipeline_create_commands (useful for topping up)

'pipeline_name' => $self->default_pipeline_name(),

'pipeline_db' => {
-driver => $self->o('hive_driver'),
-host => $self->o('host'),
-port => $self->o('port'),
-user => $self->o('user'),
-pass => $self->o('password'),
-dbname => $self->o('dbowner').'_'.$self->processed_pipeline_name(),
-dbname => $self->o('dbowner').'_'.$self->o('pipeline_name'),
},
};
}
Expand All @@ -138,7 +140,7 @@ sub pipeline_create_commands {
my $pipeline_url = $self->pipeline_url();
my $second_pass = $pipeline_url!~ /^#:subst/;

my $parsed_url = $second_pass && Bio::EnsEMBL::Hive::Utils::URL::parse( $pipeline_url );
my $parsed_url = $second_pass && (Bio::EnsEMBL::Hive::Utils::URL::parse( $pipeline_url ) || die "Could not parse the '$pipeline_url' as the database URL");
my $driver = $second_pass ? $parsed_url->{'driver'} : '';
my $hive_force_init = $self->o('hive_force_init');

Expand Down Expand Up @@ -238,7 +240,7 @@ sub hive_meta_table {

return {
'hive_sql_schema_version' => Bio::EnsEMBL::Hive::DBSQL::SqlSchemaAdaptor->get_code_sql_schema_version(),
'hive_pipeline_name' => $self->processed_pipeline_name(),
'hive_pipeline_name' => $self->o('pipeline_name'),
'hive_use_param_stack' => $self->o('hive_use_param_stack'),
'hive_auto_rebalance_semaphores' => $self->o('hive_auto_rebalance_semaphores'),
};
Expand Down Expand Up @@ -299,19 +301,14 @@ sub db_cmd {
}


sub processed_pipeline_name {
my $self = shift @_;
sub process_pipeline_name {
my ($self, $ppn) = @_;

unless($self->{'_processed_pipeline_name'}) { # due to the way substitution works in DependentOptions, caching is essential here
my $ppn = $self->root()->{'pipeline_name'} || $self->default_pipeline_name();
$ppn=~s/([[:lower:]])([[:upper:]])/${1}_${2}/g; # CamelCase into Camel_Case
$ppn=~s/\s/_/g; # remove all spaces
$ppn = lc($ppn);
$ppn=~s/([[:lower:]])([[:upper:]])/${1}_${2}/g; # CamelCase into Camel_Case
$ppn=~s/\s/_/g; # remove all spaces
$ppn = lc($ppn);

$self->{'_processed_pipeline_name'} = $ppn;
}

return $self->{'_processed_pipeline_name'};
return $ppn;
}


Expand Down Expand Up @@ -345,7 +342,6 @@ sub process_options {
# pre-patch definitely_used_options:
$self->{'_extra_options'} = $self->load_cmdline_options( $self->pre_options() );
$self->root()->{'pipeline_url'} = $self->{'_extra_options'}{'pipeline_url'};
$self->root()->{'pipeline_name'} = $self->{'_extra_options'}{'pipeline_name'};

my @use_cases = ( 'pipeline_wide_parameters', 'resource_classes', 'pipeline_analyses', 'beekeeper_extra_cmdline_options', 'hive_meta_table' );
if($include_pcc_use_case) {
Expand All @@ -354,7 +350,11 @@ sub process_options {
}
$self->use_cases( \@use_cases );

return $self->SUPER::process_options();
$self->SUPER::process_options();

# post-processing:
$self->root()->{'pipeline_name'} = $self->process_pipeline_name( $self->root()->{'pipeline_name'} );
$self->root()->{'pipeline_db'}{'-dbname'} &&= $self->process_pipeline_name( $self->root()->{'pipeline_db'}{'-dbname'} ); # may be used to construct $self->pipeline_url()
}


Expand Down Expand Up @@ -589,7 +589,7 @@ sub useful_commands_legend {
my $self = shift @_;

my $pipeline_url = '"' . $self->pipeline_url() . '"';
my $pipeline_name = $self->processed_pipeline_name();
my $pipeline_name = $self->o('pipeline_name');
my $extra_cmdline = $self->beekeeper_extra_cmdline_options();

my @output_lines = (
Expand Down

0 comments on commit 8dd0f4c

Please sign in to comment.