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

allow the data for AddTogether to be read across databases (using a full NakedTable URL)

parent 8e0898fa
......@@ -83,6 +83,10 @@ sub pipeline_create_commands {
# additional tables needed for long multiplication pipeline's operation:
$self->db_cmd('CREATE TABLE final_result (a_multiplier varchar(255) NOT NULL, b_multiplier varchar(255) NOT NULL, result varchar(255) NOT NULL, PRIMARY KEY (a_multiplier, b_multiplier))'),
$self->db_cmd('CREATE TABLE intermediate_result (a_multiplier varchar(255) NOT NULL, digit char(1) NOT NULL, partial_product varchar(255) NOT NULL, PRIMARY KEY (a_multiplier, digit))'),
# 'rm -f foreign_db',
# $self->db_cmd('CREATE TABLE intermediate_result (a_multiplier varchar(255) NOT NULL, digit char(1) NOT NULL, partial_product varchar(255) NOT NULL, PRIMARY KEY (a_multiplier, digit))', 'sqlite:///foreign_db'),
];
}
......@@ -143,16 +147,19 @@ sub pipeline_analyses {
-module => 'Bio::EnsEMBL::Hive::RunnableDB::LongMult::PartMultiply',
-analysis_capacity => 4, # use per-analysis limiter
-flow_into => {
1 => [ ':////intermediate_result' ],
1 => [
':////intermediate_result',
# 'sqlite:///foreign_db/intermediate_result',
],
},
-can_be_empty => 1,
},
{ -logic_name => 'add_together',
-module => 'Bio::EnsEMBL::Hive::RunnableDB::LongMult::AddTogether',
# -analysis_capacity => 0, # this is a way to temporarily block a given analysis
-parameters => {
'intermediate_table_name' => 'intermediate_result',
'intermediate_table_url' => ':////intermediate_result',
# 'intermediate_table_url' => 'sqlite:///foreign_db/intermediate_result',
},
-wait_for => [ 'part_multiply' ],
-flow_into => {
......
......@@ -39,6 +39,8 @@ package Bio::EnsEMBL::Hive::RunnableDB::LongMult::AddTogether;
use strict;
use warnings;
use Bio::EnsEMBL::Hive::TheApiary;
use base ('Bio::EnsEMBL::Hive::Process');
......@@ -51,7 +53,7 @@ use base ('Bio::EnsEMBL::Hive::Process');
sub param_defaults {
return {
'intermediate_table_name' => undef, # if defined, take data from there rather than from accu
'intermediate_table_url' => undef, # if defined, take data from there rather than from accu
'partial_product' => { }, # to be used when b_multiplier only contains digits '0' and '1'
'take_time' => 0, # how much time run() method will spend in sleeping state
};
......@@ -75,12 +77,12 @@ sub fetch_input { # fetch all the (relevant) precomputed products
my $self = shift @_;
my $a_multiplier = $self->param_required('a_multiplier');
my $intermediate_table_name = $self->param('intermediate_table_name');
my $intermediate_table_url = $self->param('intermediate_table_url');
my $partial_product;
if($intermediate_table_name) { # special compatibility mode, where data is fetched from a given table
my $intermediate_table_adaptor = $self->db->get_NakedTableAdaptor( 'table_name' => $intermediate_table_name );
$partial_product = $self->param('partial_product', $intermediate_table_adaptor->fetch_by_a_multiplier_HASHED_FROM_digit_TO_partial_product( $a_multiplier ) );
if($intermediate_table_url) { # special compatibility mode, where data is fetched from a given table
my $intermediate_table = Bio::EnsEMBL::Hive::TheApiary->find_by_url( $intermediate_table_url, $self->input_job->hive_pipeline );
$partial_product = $self->param('partial_product', $intermediate_table->adaptor->fetch_by_a_multiplier_HASHED_FROM_digit_TO_partial_product( $a_multiplier ) );
} else {
$partial_product = $self->param('partial_product');
}
......
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