/[webpac2]/trunk/run.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/run.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 606 by dpavlin, Tue Aug 1 13:59:47 2006 UTC revision 607 by dpavlin, Tue Aug 1 14:15:50 2006 UTC
# Line 89  Force dump or input and marc record for Line 89  Force dump or input and marc record for
89  Run databases in parallel (aproximatly same as number of processors in  Run databases in parallel (aproximatly same as number of processors in
90  machine if you want to use full load)  machine if you want to use full load)
91    
92    =item --only-links
93    
94    Create just links
95    
96  =back  =back
97    
98  =cut  =cut
# Line 105  my $validate_path; Line 109  my $validate_path;
109  my ($marc_normalize, $marc_output);  my ($marc_normalize, $marc_output);
110  my $marc_lint = 1;  my $marc_lint = 1;
111  my $marc_dump = 0;  my $marc_dump = 0;
   
112  my $parallel = 0;  my $parallel = 0;
113    my $only_links = 0;
114    
115  GetOptions(  GetOptions(
116          "limit=i" => \$limit,          "limit=i" => \$limit,
# Line 123  GetOptions( Line 127  GetOptions(
127          "marc-lint!" => \$marc_lint,          "marc-lint!" => \$marc_lint,
128          "marc-dump!" => \$marc_dump,          "marc-dump!" => \$marc_dump,
129          "parallel=i" => \$parallel,          "parallel=i" => \$parallel,
130            "only-links!" => \$only_links,
131  );  );
132    
133  $config = LoadFile($config);  $config = LoadFile($config);
# Line 154  my $total_rows = 0; Line 159  my $total_rows = 0;
159  my $start_t = time();  my $start_t = time();
160    
161  my @links;  my @links;
 my $indexer;  
162    
163  if ($parallel) {  if ($parallel) {
164          $log->info("Using $parallel processes for speedup");          $log->info("Using $parallel processes for speedup");
# Line 175  while (my ($database, $db_config) = each Line 179  while (my ($database, $db_config) = each
179                  }                  }
180          }          }
181    
182            my $indexer;
183          if ($use_indexer) {          if ($use_indexer) {
184                  my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration");                  my $indexer_config = $config->{$use_indexer} || $log->logdie("can't find '$use_indexer' part in confguration");
185                  $indexer_config->{database} = $database;                  $indexer_config->{database} = $database;
# Line 203  while (my ($database, $db_config) = each Line 208  while (my ($database, $db_config) = each
208    
209    
210          #          #
211            # store Hyper Estraier links to other databases
212            #
213            if (ref($db_config->{links}) eq 'ARRAY' && $use_indexer) {
214                    foreach my $link (@{ $db_config->{links} }) {
215                            if ($use_indexer eq 'hyperestraier') {
216                                    $log->info("saving link $database -> $link->{to} [$link->{credit}]");
217                                    push @links, sub {
218                                            $log->info("adding link $database -> $link->{to} [$link->{credit}]");
219                                            $indexer->add_link(
220                                                    from => $database,
221                                                    to => $link->{to},
222                                                    credit => $link->{credit},
223                                            );
224                                    };
225                            } else {
226                                    $log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]");
227                            }
228                    }
229            }
230            next if ($only_links);
231    
232    
233            #
234          # now WebPAC::Store          # now WebPAC::Store
235          #          #
236          my $abs_path = abs_path($0);          my $abs_path = abs_path($0);
# Line 397  while (my ($database, $db_config) = each Line 425  while (my ($database, $db_config) = each
425                  )                  )
426          );          );
427    
         #  
         # add Hyper Estraier links to other databases  
         #  
         if (ref($db_config->{links}) eq 'ARRAY' && $use_indexer) {  
                 foreach my $link (@{ $db_config->{links} }) {  
                         if ($use_indexer eq 'hyperestraier') {  
                                 $log->info("saving link $database -> $link->{to} [$link->{credit}]");  
                                 push @links, {  
                                         from => $database,  
                                         to => $link->{to},  
                                         credit => $link->{credit},  
                                 };  
                         } else {  
                                 $log->warn("NOT IMPLEMENTED WITH $use_indexer: adding link $database -> $link->{to} [$link->{credit}]");  
                         }  
                 }  
         }  
428    
429          # end forked process          # end forked process
430          if ($parallel) {          if ($parallel) {
# Line 429  if ($parallel) { Line 440  if ($parallel) {
440          $log->info("all parallel processes finished");          $log->info("all parallel processes finished");
441  }  }
442    
443    
444  foreach my $link (@links) {  foreach my $link (@links) {
445          $log->info("adding link $link->{from} -> $link->{to} [$link->{credit}]");          $log->logdie("coderef in link ", Dumper($link), " is ", ref($link), " and not CODE") unless (ref($link) eq 'CODE');
446          $indexer->add_link( %{ $link } );          $link->();
447  }  }
448    

Legend:
Removed from v.606  
changed lines
  Added in v.607

  ViewVC Help
Powered by ViewVC 1.1.26