@@ -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,6 +103,41 @@ sub print_process_workflow {
102103 $self -> fh-> say (" " );
103104 map { $self -> fh-> say ($_ ) } @{$text };
104105
106+ $self -> print_stats_rules($rule );
107+
108+ }
109+ }
110+
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+ foreach my $sample ($self -> all_samples){
135+ $self -> fh-> say (" " );
136+ $self -> fh-> say (
137+ " biox stats --samples " . $sample . " \\ " );
138+ $self -> fh-> say ( " --select_rules " . $rule . " \\ " );
139+ $self -> fh-> say ( " -w " . $self -> cached_workflow );
140+ $self -> fh-> say (" " );
105141 }
106142}
107143
@@ -165,67 +201,64 @@ sub process_auto_deps {
165201 my @text = split ( " \n " , $before_meta );
166202 $self -> process_obj-> {$rule }-> {meta } = \@text ;
167203 }
168-
169-
170204}
171205
172206# TODO Add in deps check
173207
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- }
208+ # has 'orphan_table' => (
209+ # is => 'rw',
210+ # default => sub {
211+ # my $self = shift;
212+ # my $t = Text::ASCIITable->new();
213+ # $t->setCols( [ 'Rule', 'INPUT', 'Possible Matches' ] );
214+ # return $t;
215+ # }
216+ # );
217+ #
218+ # has 'orphan_inputs' => (
219+ # is => 'rw',
220+ # isa => 'Bool',
221+ # default => 0,
222+ # );
223+ #
224+ # sub check_input_output {
225+ # my $self = shift;
226+ # my $rule = shift;
227+ #
228+ # #if this exists it means we already processed this through hpc-deps
229+ # # return if exists $self->graph->{$rule};
230+ # $self->graph->{$rule} = [] if !exists $self->graph->{$rule};
231+ #
232+ # my @INPUTS = keys %{ $self->rule_deps->{$rule}->{INPUT} };
233+ #
234+ # #TODO Add Seen
235+ #
236+ # foreach my $srule ( $self->all_select_rule_keys ) {
237+ # next if $srule eq $rule;
238+ # my @trow = ();
239+ #
240+ # my @inter = grep( $self->rule_deps->{$srule}->{OUTPUT}->{$_}, @INPUTS );
241+ # if ( !@inter ) {
242+ # $self->orphan_inputs(1);
243+ # my @OUTPUTS = keys %{ $self->rule_deps->{$srule}->{OUTPUT} };
244+ # map {
245+ # my @matches = amatch( $_, @OUTPUTS );
246+ # my @rels = map { path($_)->relative->stringify } @matches;
247+ # my $f = path($_)->relative->stringify;
248+ #
249+ # push( @trow, $rule );
250+ # push( @trow, $f );
251+ # push( @trow, join( "\n", @rels ) );
252+ # $self->orphan_table->addRow( \@trow );
253+ # $self->orphan_table->addRowLine();
254+ # @trow = ();
255+ #
256+ # } @INPUTS;
257+ # }
258+ # else {
259+ # push( @{ $self->graph->{$rule} }, $srule );
260+ # }
261+ # }
262+ # }
230263
2312641;
0 commit comments