Commit 466eff91 authored by Leo Gordon's avatar Leo Gordon
Browse files

removed param_substitute() call from Runnables -- no longer needed, as substitution is automatic

parent 4738451a
......@@ -95,10 +95,8 @@ sub fetch_input {
# Output file / output database
$self->param('output_file') || $self->param('output_db') || die 'One of the parameters "output_file" and "output_db" is mandatory';
if ($self->param('output_file')) {
$self->param('real_output_file', $self->param_substitute($self->param('output_file')));
} else {
$self->param('real_output_db', $self->go_figure_dbc($self->param_substitute($self->param('output_db'))));
unless ($self->param('output_file')) {
$self->param('real_output_db', $self->go_figure_dbc( $self->param('output_db') ) );
die 'Only the "mysql" driver is supported.' if $self->param('real_output_db')->driver ne 'mysql';
}
......@@ -112,7 +110,7 @@ sub fetch_input {
sub _get_table_list {
my $self = shift @_;
my $table_list = $self->param_substitute($self->param('table_list') || '');
my $table_list = $self->param('table_list') || '';
my @newtables = ();
my $dbc = $self->param('src_dbc');
foreach my $initable (ref($table_list) eq 'ARRAY' ? @$table_list : split(' ', $table_list)) {
......@@ -148,7 +146,7 @@ sub run {
'--skip-lock-tables',
@$tables,
(map {sprintf('--ignore-table=%s.%s', $src_dbc->dbname, $_)} @$ignores),
$self->param('output_file') ? sprintf('> %s', $self->param('real_output_file')) : sprintf(' | mysql %s', $self->mysql_conn_from_dbc($self->param('real_output_db'))),
$self->param('output_file') ? sprintf('> %s', $self->param('output_file')) : sprintf(' | mysql %s', $self->mysql_conn_from_dbc($self->param('real_output_db'))),
);
print "$cmd\n" if $self->debug;
......
......@@ -73,13 +73,13 @@ use base ('Bio::EnsEMBL::Hive::Process');
# The following 4 parameters are mutually exclusive and define the source of ids for the jobs:
param('inputlist'); [param_substituted] The list is explicitly given in the parameters, can be abbreviated: 'inputlist' => ['a'..'z']
param('inputlist'); The list is explicitly given in the parameters, can be abbreviated: 'inputlist' => ['a'..'z']
param('inputfile'); [param_substituted] The list is contained in a file whose name is supplied as parameter: 'inputfile' => 'myfile.txt'
param('inputfile'); The list is contained in a file whose name is supplied as parameter: 'inputfile' => 'myfile.txt'
param('inputquery'); [param_substituted] The list is generated by an SQL query (against the production database by default) : 'inputquery' => 'SELECT object_id FROM object WHERE x=y'
param('inputquery'); The list is generated by an SQL query (against the production database by default) : 'inputquery' => 'SELECT object_id FROM object WHERE x=y'
param('inputcmd'); [param_substituted] The list is generated by running a system command: 'inputcmd' => 'find /tmp/big_directory -type f'
param('inputcmd'); The list is generated by running a system command: 'inputcmd' => 'find /tmp/big_directory -type f'
=cut
......@@ -103,10 +103,10 @@ sub run {
my $parse_column_names = $column_names && (ref($column_names) ne 'ARRAY');
my ($rows, $column_names_from_data) =
$inputlist ? $self->_get_rows_from_list( $self->param_substitute( $inputlist ) )
: $inputquery ? $self->_get_rows_from_query( $self->param_substitute( $inputquery ) )
: $inputfile ? $self->_get_rows_from_open( $self->param_substitute( $inputfile ), $delimiter, $parse_column_names )
: $inputcmd ? $self->_get_rows_from_open( $self->param_substitute( $inputcmd ).' |', $delimiter, $parse_column_names )
$inputlist ? $self->_get_rows_from_list( $inputlist )
: $inputquery ? $self->_get_rows_from_query( $inputquery )
: $inputfile ? $self->_get_rows_from_open( $inputfile , $delimiter, $parse_column_names )
: $inputcmd ? $self->_get_rows_from_open( "$inputcmd |", $delimiter, $parse_column_names )
: die "range of values should be defined by setting 'inputlist', 'inputquery', 'inputfile' or 'inputcmd'";
if( $column_names_from_data # column data is available
......
......@@ -41,9 +41,9 @@ use base ('Bio::EnsEMBL::Hive::Process');
param('mode'): 'overwrite' (default), 'topup' or 'insertignore'
param('where'): filter for rows to be copied/merged. [ param_substituted ]
param('where'): filter for rows to be copied/merged.
param('table'): table name to be copied/merged. [ param_substituted ]
param('table'): table name to be copied/merged.
=cut
......@@ -60,8 +60,6 @@ sub fetch_input {
my $table = $self->param('table') or die "Please specify 'table' parameter\n";
$self->input_job->transient_error(1);
$table = $self->param('table', $self->param_substitute($table) );
my $src_dbc = $src_db_conn ? $self->go_figure_dbc( $src_db_conn ) : $self->db->dbc;
my $dest_dbc = $dest_db_conn ? $self->go_figure_dbc( $dest_db_conn ) : $self->db->dbc;
......@@ -72,9 +70,6 @@ sub fetch_input {
$self->param('mode', $self->param('mode'));
my $where = $self->param('where');
if(defined($where)) {
$where = $self->param( 'where', $self->param_substitute($where) );
}
$self->param('src_before', $self->get_row_count($src_dbc, $table, $where) );
......
......@@ -68,10 +68,6 @@ sub run {
my $subject = $self->param('subject') || "An automatic message from your pipeline";
my $text = $self->param('text') || die "'text' parameter is obligatory";
# Run parameter substitutions:
#
$text = $self->param_substitute($text);
open(SENDMAIL, "|sendmail $email");
print SENDMAIL "Subject: $subject\n";
print SENDMAIL "\n";
......
......@@ -61,7 +61,7 @@ sub strict_hash_format {
Here it deals with finding the sql command(s), doing parameter substitution, storing the result in a predefined place
and optionally connecting to another database (see param('db_conn')).
param('sql'): The recommended way of passing in the sql command(s). [param_substituted]
param('sql'): The recommended way of passing in the sql command(s).
param('db_conn'): An optional hash to pass in connection parameters to the database upon which the sql command(s) will have to be run.
......@@ -102,10 +102,7 @@ sub run {
my %output_id;
my $counter = 0;
foreach my $unsubst_sql (@$sqls) {
# Perform parameter substitution:
my $sql = $self->param_substitute($unsubst_sql);
foreach my $sql (@$sqls) {
if($self->debug()) {
warn qq{sql = "$sql"\n};
......
......@@ -68,7 +68,7 @@ sub strict_hash_format {
Description : Implements fetch_input() interface method of Bio::EnsEMBL::Hive::Process that is used to read in parameters and load data.
Here it deals with finding the command line, doing parameter substitution and storing the result in a predefined place.
param('cmd'): The recommended way of passing in the command line. [param_substituted]
param('cmd'): The recommended way of passing in the command line.
param('*'): Any other parameters can be freely used for parameter substitution.
......@@ -86,7 +86,7 @@ sub fetch_input {
# Store the value with parameter substitutions for the actual execution:
#
$self->param('cmd', $self->param_substitute($cmd));
$self->param('cmd', $cmd);
}
......
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