@@ -5,6 +5,8 @@ use String::Approx 'amatch';
55use Algorithm::Dependency::Source::HoA;
66use Algorithm::Dependency::Ordered;
77use Try::Tiny;
8+ use Path::Tiny;
9+ use Text::ASCIITable;
810use Data::Dumper;
911
1012# Not even close to this yet
@@ -60,13 +62,23 @@ sub post_process_rules {
6062 . join ( ' , ' , @{ $self -> select_rule_keys } )
6163 . " \n " )
6264 if $self -> use_timestamps;
63- $self -> app_log-> info( ' Looking for orphan INPUTs '
64- . ' (INPUTs with no corresponding OUTPUTs)' );
65+ # $self->app_log->info( 'Looking for orphan INPUTs '
66+ # . '(INPUTs with no corresponding OUTPUTs)' );
6567
68+ my $rule_count = 0;
6669 foreach my $rule ( $self -> all_select_rule_keys ) {
70+ # #Skip the first rule
71+ if ( $rule_count == 0 ) {
72+ $rule_count ++;
73+ next ;
74+ }
6775 $self -> check_input_output($rule );
6876 }
6977
78+
79+ $self -> app_log-> warn ( " Found Orphan Inputs (inputs with no corresponding outputs)\n " . $self -> orphan_table )
80+ if $self -> orphan_inputs;
81+
7082 $self -> dedeps;
7183 $self -> process_auto_deps;
7284
@@ -76,12 +88,12 @@ sub post_process_rules {
7688sub print_process_workflow {
7789 my $self = shift ;
7890
91+ $self -> app_log-> info( ' Post processing rules and printing workflow...' );
7992 foreach my $rule ( $self -> all_rule_names ) {
8093
8194 # TODO This should be named select_rule_names
8295 my $index = $self -> first_index_select_rule_keys( sub { $_ eq $rule } );
8396 next if $index == -1;
84- $self -> app_log-> info( ' Post processing ' . $rule );
8597
8698 my $meta = $self -> process_obj-> {$rule }-> {meta } || [];
8799 my $text = $self -> process_obj-> {$rule }-> {text } || [];
@@ -148,16 +160,33 @@ sub process_auto_deps {
148160 my @deps = @{ $self -> graph-> {$rule } };
149161 if (@deps ) {
150162 chomp ($before_meta );
151- $before_meta .= " \n #HPC deps=" . join ( ' ,' , @deps ). " \n\n " ;
163+ $before_meta .= " \n #HPC deps=" . join ( ' ,' , @deps ) . " \n\n " ;
152164 }
153165 my @text = split ( " \n " , $before_meta );
154166 $self -> process_obj-> {$rule }-> {meta } = \@text ;
155167 }
156168
169+
157170}
158171
159172# TODO Add in deps check
160173
174+ has ' orphan_table' => (
175+ is => ' rw' ,
176+ default => sub {
177+ my $self = shift ;
178+ my $t = Text::ASCIITable-> new();
179+ $t -> setCols( [ ' Rule' , ' INPUT' , ' Possible Matches' ] );
180+ return $t ;
181+ }
182+ );
183+
184+ has ' orphan_inputs' => (
185+ is => ' rw' ,
186+ isa => ' Bool' ,
187+ default => 0,
188+ );
189+
161190sub check_input_output {
162191 my $self = shift ;
163192 my $rule = shift ;
@@ -172,17 +201,24 @@ sub check_input_output {
172201
173202 foreach my $srule ( $self -> all_select_rule_keys ) {
174203 next if $srule eq $rule ;
204+ my @trow = ();
175205
176206 my @inter = grep ( $self -> rule_deps-> {$srule }-> {OUTPUT }-> {$_ }, @INPUTS );
177207 if ( !@inter ) {
208+ $self -> orphan_inputs(1);
178209 my @OUTPUTS = keys %{ $self -> rule_deps-> {$srule }-> {OUTPUT } };
179210 map {
180211 my @matches = amatch( $_ , @OUTPUTS );
181- $self -> app_log-> warn ( " Orphan INPUT:"
182- . " \t Rule: $rule File: $_ \n "
183- . " \t Possible matches include "
184- . join ( " , " , @matches ) )
185- if @matches
212+ my @rels = map { path($_ )-> relative-> stringify } @matches ;
213+ my $f = path($_ )-> relative-> stringify;
214+
215+ push ( @trow , $rule );
216+ push ( @trow , $f );
217+ push ( @trow , join ( " \n " , @rels ) );
218+ $self -> orphan_table-> addRow( \@trow );
219+ $self -> orphan_table-> addRowLine();
220+ @trow = ();
221+
186222 } @INPUTS ;
187223 }
188224 else {
0 commit comments