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

introduced Cacheable::is_local_to to centralize friend-or-foe recognition

parent 6cfd6615
......@@ -78,7 +78,7 @@ sub display_name {
my $my_pipeline = $self->hive_pipeline;
my $my_dba = $my_pipeline && $my_pipeline->hive_dba;
return ( ($my_dba and $my_pipeline!=$ref_pipeline) ? $my_dba->dbc->dbname . '/' : '' ) . $self->struct_name . $self->signature_template;
return ( ($my_dba and $self->is_local_to($ref_pipeline) ) ? $my_dba->dbc->dbname . '/' : '' ) . $self->struct_name . $self->signature_template;
}
......
......@@ -195,7 +195,7 @@ sub display_name {
my $my_pipeline = $self->hive_pipeline;
my $my_dba = $my_pipeline && $my_pipeline->hive_dba;
return ( ($my_dba and $my_pipeline!=$ref_pipeline) ? $my_dba->dbc->dbname . '/' : '' ) . $self->logic_name;
return ( ($my_dba and !$self->is_local_to($ref_pipeline) ) ? $my_dba->dbc->dbname . '/' : '' ) . $self->logic_name;
}
......
......@@ -41,6 +41,15 @@ sub hive_pipeline {
return $self->{'_hive_pipeline'};
}
sub is_local_to {
my $self = shift @_;
my $rel_pipeline = shift @_;
return $self->hive_pipeline == $rel_pipeline;
}
sub unikey { # to be redefined by individual Cacheable classes
return undef;
}
......
......@@ -76,7 +76,7 @@ sub display_name {
my $my_pipeline = $self->hive_pipeline;
my $my_dba = $my_pipeline && $my_pipeline->hive_dba;
return ( ($my_dba and $my_pipeline!=$ref_pipeline) ? $my_dba->dbc->dbname . '/' : '' ) . $self->table_name;
return ( ($my_dba and $self->is_local_to($ref_pipeline) ) ? $my_dba->dbc->dbname . '/' : '' ) . $self->table_name;
}
......
......@@ -170,8 +170,7 @@ sub build {
# NB: this is a very approximate algorithm with rough edges!
# It will not find all start nodes in cyclic components!
foreach my $source_analysis ( $pipeline->collection_of('Analysis')->list ) {
my $is_foreign = $source_analysis->hive_pipeline != $pipeline;
if( !$source_analysis->inflow_rules_count and !$is_foreign ) { # if there is no dataflow into this analysis
if( !$source_analysis->inflow_rules_count and $source_analysis->is_local_to($pipeline) ) { # if there is no dataflow into this analysis
# run the recursion in each component that has a non-cyclic start:
$self->_propagate_allocation( $source_analysis );
}
......@@ -403,8 +402,8 @@ sub _add_control_rules {
my $condition_analysis = $c_rule->condition_analysis;
my $ctrled_analysis = $c_rule->ctrled_analysis;
my $ctrled_is_local = $ctrled_analysis->hive_pipeline == $self->pipeline;
my $condition_is_local = $condition_analysis->hive_pipeline == $self->pipeline;
my $ctrled_is_local = $ctrled_analysis->is_local_to( $self->pipeline );
my $condition_is_local = $condition_analysis->is_local_to( $self->pipeline );
if($ctrled_is_local and !$condition_is_local) {
$self->{'_foreign_analyses'}{ $condition_analysis->display_name($self->pipeline) } = $condition_analysis;
......@@ -451,8 +450,8 @@ sub _add_dataflow_rules {
$target_node_name = $self->_analysis_node_name( $target_object );
my $from_is_local = $from_analysis->hive_pipeline == $self->pipeline;
my $target_is_local = $target_object->hive_pipeline == $self->pipeline;
my $from_is_local = $from_analysis->is_local_to( $self->pipeline );
my $target_is_local = $target_object->is_local_to( $self->pipeline );
if($from_is_local and !$target_is_local) {
$self->{'_foreign_analyses'}{ $target_object->display_name($self->pipeline) } = $target_object;
......
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