Log more info on batch completion
authorBill Erickson <berickxx@gmail.com>
Tue, 12 Apr 2016 15:49:04 +0000 (11:49 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 12 Apr 2016 15:49:05 +0000 (11:49 -0400)
Log the last record processed for non-browse reingest.  Make logging
more consistent across browse and non-browse reingest stages.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
pingest.pl

index ce07e47..ee25bd4 100755 (executable)
@@ -245,12 +245,15 @@ while ($count < $lists) {
         if (grep {$_ == $pid} @running) {
             @running = grep {$_ != $pid} @running;
             $count++;
-            announce('INFO', "$count of $lists processed");
+            announce('DEBUG', 
+                "reingest() processed $count of $lists batches");
         }
     }
 
     if ($duration_expired && scalar(@running) == 0) {
-        announce('INFO', "Exiting on max_duration ($max_duration)");
+        my $last_rec = pop(@$records);
+        announce('INFO', 
+            "reingest() stopping on record $last_rec on max duration");
         exit(0);
     }
 }
@@ -272,6 +275,8 @@ sub browse_ingest {
     } elsif ($pid == 0) {
         my $dbh = DBI->connect('DBI:Pg:');
         my $sth = $dbh->prepare("SELECT metabib.reingest_metabib_field_entries(?, TRUE, FALSE, TRUE)");
+        my $total = scalar(@list);
+        my $count = 0;
         foreach (@list) {
             if ($sth->execute($_)) {
                 my $crap = $sth->fetchall_arrayref();
@@ -283,6 +288,10 @@ sub browse_ingest {
                     "browse_ingest() stopping on record $_ on max duration");
                 last;
             }
+
+            announce('DEBUG', 
+                "browse_ingest() processed $count of $total records")
+                if ++$count % $batch_size == 0;
         }
         $dbh->disconnect();
         exit(0);