@@ -58,26 +58,27 @@ sub post_process_rules {
5858
5959 # Create flags for outputs that have a similar input
6060 $self -> app_log-> info();
61+
6162 # $self->app_log->info( 'Selected rules:' . "\t"
6263 # . join( ', ', @{ $self->select_rule_keys } )
6364 # . "\n" )
6465 # if $self->use_timestamps;
6566 # $self->app_log->info( 'Looking for orphan INPUTs '
6667 # . '(INPUTs with no corresponding OUTPUTs)' );
6768
68- # my $rule_count = 0;
69- # foreach my $rule ( $self->all_select_rule_keys ) {
70- # ##Skip the first rule
71- # if ( $rule_count == 0 ) {
72- # $rule_count++;
73- # next;
74- # }
75- # $self->check_input_output($rule);
76- # }
77- #
78- #
79- # $self->app_log->warn( "Found Orphan Inputs (inputs with no corresponding outputs)\n" . $self->orphan_table )
80- # if $self->orphan_inputs;
69+ # my $rule_count = 0;
70+ # foreach my $rule ( $self->all_select_rule_keys ) {
71+ # ##Skip the first rule
72+ # if ( $rule_count == 0 ) {
73+ # $rule_count++;
74+ # next;
75+ # }
76+ # $self->check_input_output($rule);
77+ # }
78+ #
79+ #
80+ # $self->app_log->warn( "Found Orphan Inputs (inputs with no corresponding outputs)\n" . $self->orphan_table )
81+ # if $self->orphan_inputs;
8182
8283 $self -> dedeps;
8384 $self -> process_auto_deps;
@@ -88,7 +89,7 @@ sub post_process_rules {
8889sub print_process_workflow {
8990 my $self = shift ;
9091
91- $self -> app_log-> info( ' Post processing rules and printing workflow...' );
92+ $self -> app_log-> info(' Post processing rules and printing workflow...' );
9293 foreach my $rule ( $self -> all_rule_names ) {
9394
9495 # TODO This should be named select_rule_names
@@ -102,9 +103,41 @@ sub print_process_workflow {
102103 $self -> fh-> say (" " );
103104 map { $self -> fh-> say ($_ ) } @{$text };
104105
106+ $self -> print_stats_rules($rule );
107+
105108 }
106109}
107110
111+ sub print_stats_rules {
112+ my $self = shift ;
113+ my $rule = shift ;
114+
115+ return unless $self -> run_stats;
116+ $self -> fh-> say (" " );
117+
118+ $self -> fh-> say ( $self -> comment_char );
119+ $self -> fh-> say (
120+ $self -> comment_char . " Starting " . $rule . " _biox_stats" );
121+ $self -> fh-> say ( $self -> comment_char );
122+ $self -> fh-> say (" " );
123+
124+ $self -> fh-> say ( $self -> comment_char );
125+ $self -> fh-> say ( ' ### HPC Directives' . " \n " );
126+ $self -> fh-> say ( $self -> comment_char );
127+ $self -> fh-> say ( ' #HPC jobname=' . $rule . " _biox_stats" );
128+ $self -> fh-> say ( ' #HPC deps=' . $rule );
129+ $self -> fh-> say (' #HPC mem=2GB' );
130+ $self -> fh-> say (' #HPC cpus_per_task=1' );
131+ $self -> fh-> say ( $self -> comment_char );
132+ $self -> fh-> say (" " );
133+
134+ $self -> fh-> say (
135+ " biox stats --samples " . join ( ' ,' , @{ $self -> samples } ) . " \\ " );
136+ $self -> fh-> say ( " --select_rules " . $rule . " \\ " );
137+ $self -> fh-> say ( " -w " . $self -> cached_workflow );
138+ $self -> fh-> say (" " );
139+ }
140+
108141=head3 dedeps
109142
110143If using select_rules comment out the #HPC deps portion on the first rule
@@ -165,67 +198,64 @@ sub process_auto_deps {
165198 my @text = split ( " \n " , $before_meta );
166199 $self -> process_obj-> {$rule }-> {meta } = \@text ;
167200 }
168-
169-
170201}
171202
172203# TODO Add in deps check
173204
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-
190- sub check_input_output {
191- my $self = shift ;
192- my $rule = shift ;
193-
194- # if this exists it means we already processed this through hpc-deps
195- # return if exists $self->graph->{$rule};
196- $self -> graph-> {$rule } = [] if !exists $self -> graph-> {$rule };
197-
198- my @INPUTS = keys %{ $self -> rule_deps-> {$rule }-> {INPUT } };
199-
200- # TODO Add Seen
201-
202- foreach my $srule ( $self -> all_select_rule_keys ) {
203- next if $srule eq $rule ;
204- my @trow = ();
205-
206- my @inter = grep ( $self -> rule_deps-> {$srule }-> {OUTPUT }-> {$_ }, @INPUTS );
207- if ( !@inter ) {
208- $self -> orphan_inputs(1);
209- my @OUTPUTS = keys %{ $self -> rule_deps-> {$srule }-> {OUTPUT } };
210- map {
211- my @matches = amatch( $_ , @OUTPUTS );
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-
222- } @INPUTS ;
223- }
224- else {
225- push ( @{ $self -> graph-> {$rule } }, $srule );
226- }
227- }
228-
229- }
205+ # has 'orphan_table' => (
206+ # is => 'rw',
207+ # default => sub {
208+ # my $self = shift;
209+ # my $t = Text::ASCIITable->new();
210+ # $t->setCols( [ 'Rule', 'INPUT', 'Possible Matches' ] );
211+ # return $t;
212+ # }
213+ # );
214+ #
215+ # has 'orphan_inputs' => (
216+ # is => 'rw',
217+ # isa => 'Bool',
218+ # default => 0,
219+ # );
220+ #
221+ # sub check_input_output {
222+ # my $self = shift;
223+ # my $rule = shift;
224+ #
225+ # #if this exists it means we already processed this through hpc-deps
226+ # # return if exists $self->graph->{$rule};
227+ # $self->graph->{$rule} = [] if !exists $self->graph->{$rule};
228+ #
229+ # my @INPUTS = keys %{ $self->rule_deps->{$rule}->{INPUT} };
230+ #
231+ # #TODO Add Seen
232+ #
233+ # foreach my $srule ( $self->all_select_rule_keys ) {
234+ # next if $srule eq $rule;
235+ # my @trow = ();
236+ #
237+ # my @inter = grep( $self->rule_deps->{$srule}->{OUTPUT}->{$_}, @INPUTS );
238+ # if ( !@inter ) {
239+ # $self->orphan_inputs(1);
240+ # my @OUTPUTS = keys %{ $self->rule_deps->{$srule}->{OUTPUT} };
241+ # map {
242+ # my @matches = amatch( $_, @OUTPUTS );
243+ # my @rels = map { path($_)->relative->stringify } @matches;
244+ # my $f = path($_)->relative->stringify;
245+ #
246+ # push( @trow, $rule );
247+ # push( @trow, $f );
248+ # push( @trow, join( "\n", @rels ) );
249+ # $self->orphan_table->addRow( \@trow );
250+ # $self->orphan_table->addRowLine();
251+ # @trow = ();
252+ #
253+ # } @INPUTS;
254+ # }
255+ # else {
256+ # push( @{ $self->graph->{$rule} }, $srule );
257+ # }
258+ # }
259+ # }
230260
2312611;
0 commit comments