[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. 78d6a87edb62fea501676432f5a2ca65f176fbe4

Evergreen Git git at git.evergreen-ils.org
Mon Jan 5 16:45:31 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  78d6a87edb62fea501676432f5a2ca65f176fbe4 (commit)
       via  80b673db266e7bb3550469629aaf8f405935ea56 (commit)
       via  09642a753fd2bd3addeb297380b2ff6b4fb414dc (commit)
      from  e66d78b4514292ae43283728bf0f591ace42bed5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 78d6a87edb62fea501676432f5a2ca65f176fbe4
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Dec 29 17:05:39 2014 -0500

    LP#1406367 Fine generator skips no-fines transactions (parallel)
    
    Avoid inspecting no-fines transactions when running the fine generator
    in parallel mode.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 56ad4a8..b619711 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -311,7 +311,8 @@ sub grab_overdue {
 
     my $idlist = $self->api_name =~/id_list/o ? 1 : 0;
     
-    $client->respond( $idlist ? $_ : $_->to_fieldmapper ) for ( overdue_circs('', $idlist) );
+    $client->respond( $idlist ? $_ : $_->to_fieldmapper ) 
+        for ( overdue_circs('', $idlist, undef, 1) );
 
     return undef;
 
@@ -324,7 +325,8 @@ __PACKAGE__->register_method(
     signature       => q/
         Return list of overdue circulations and reservations to be used for fine generation.
         Despite the name, this is not a generic method for retrieving all overdue loans,
-        as it excludes loans that have already hit the maximum fine limit.
+        as it excludes loans that have already hit the maximum fine limit
+        and transactions which do not accrue fines.
 /,
 );
 __PACKAGE__->register_method(

commit 80b673db266e7bb3550469629aaf8f405935ea56
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Dec 29 14:04:45 2014 -0500

    LP#1406367 Fine generator skips no-fines transactions
    
    Filter out any circs or booking reservations which will never be billed
    in the initial overdue transactions query used by the fine generator.
    This allows us to avoid loading rows into memory that the fine generator
    will ignore anyway.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 3d5177e..56ad4a8 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -152,20 +152,27 @@ __PACKAGE__->register_method(
 # between the last circulation and the first reservation.  This is
 # useful in conjunction with 'idlist' so the caller can tell what type 
 # of transaction the ID refers to without having to query the DB.
+# skip_no_fines - filter out transactions which will never be billed, 
+# e.g. circs with a $0 max fine or $0 recurring fine.
 sub overdue_circs {
     my $upper_interval = shift || '1 millennium';
     my $idlist = shift;
     my $partition = shift;
+    my $skip_no_fines = shift;
 
     # Only retrieve ID's in the initial query if that's all the caller needs.
     my $contents = $idlist ? 'id' : '*';
 
+    my $fines_filter = $skip_no_fines ? 
+        'AND recurring_fine <> 0 AND max_fine <> 0' : '';
+
     my $c_t = action::circulation->table;
 
     my $sql = <<"    SQL";
         SELECT  $contents
           FROM  $c_t
           WHERE stop_fines IS NULL
+            $fines_filter
             AND due_date < ( CURRENT_TIMESTAMP - grace_period )
             AND fine_interval < ?::INTERVAL
     SQL
@@ -177,11 +184,15 @@ sub overdue_circs {
 
     push (@circs, undef) if $partition;
 
+    $fines_filter = $skip_no_fines ? 
+        'AND fine_amount <> 0 AND max_fine <> 0' : '';
+
     $c_t = booking::reservation->table;
     $sql = <<"    SQL";
         SELECT  $contents
           FROM  $c_t
           WHERE return_time IS NULL
+            $fines_filter
             AND end_time < ( CURRENT_TIMESTAMP )
             AND fine_interval IS NOT NULL
             AND cancel_time IS NULL
@@ -1062,9 +1073,11 @@ sub generate_fines {
             action::circulation->search_where( { id => $circ, stop_fines => undef } ),
             booking::reservation->search_where( { id => $circ, return_time => undef, cancel_time => undef } );
     } else {
-        push @circs, overdue_circs(undef, 1, 1);
+        push @circs, overdue_circs(undef, 1, 1, 1);
     }
 
+    $logger->info("fine generator processing ".scalar(@circs)." transactions");
+
     my %hoo = map { ( $_->id => $_ ) } actor::org_unit::hours_of_operation->retrieve_all;
 
     my $penalty = OpenSRF::AppSession->create('open-ils.penalty');

commit 09642a753fd2bd3addeb297380b2ff6b4fb414dc
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Dec 19 12:14:10 2014 -0500

    LP#1406367 Reduce Fine gen. API memory use
    
    Avoid loading the full set of billable transaction objects into
    memory when generating fines to reduce the memory footprint of the
    open-ils.storage fine generater API.  Instead, load transaction IDs
    on startup, then fetch individual transactions as needed.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 0452676..3d5177e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -148,14 +148,22 @@ __PACKAGE__->register_method(
 );
 
 
+# partition -- if set, an 'undef' will be inserted into the result list
+# between the last circulation and the first reservation.  This is
+# useful in conjunction with 'idlist' so the caller can tell what type 
+# of transaction the ID refers to without having to query the DB.
 sub overdue_circs {
     my $upper_interval = shift || '1 millennium';
     my $idlist = shift;
+    my $partition = shift;
+
+    # Only retrieve ID's in the initial query if that's all the caller needs.
+    my $contents = $idlist ? 'id' : '*';
 
     my $c_t = action::circulation->table;
 
     my $sql = <<"    SQL";
-        SELECT  *
+        SELECT  $contents
           FROM  $c_t
           WHERE stop_fines IS NULL
             AND due_date < ( CURRENT_TIMESTAMP - grace_period )
@@ -167,9 +175,11 @@ sub overdue_circs {
 
     my @circs = map { $idlist ? $_->{id} : action::circulation->construct($_) } $sth->fetchall_hash;
 
+    push (@circs, undef) if $partition;
+
     $c_t = booking::reservation->table;
     $sql = <<"    SQL";
-        SELECT  *
+        SELECT  $contents
           FROM  $c_t
           WHERE return_time IS NULL
             AND end_time < ( CURRENT_TIMESTAMP )
@@ -1052,15 +1062,31 @@ sub generate_fines {
             action::circulation->search_where( { id => $circ, stop_fines => undef } ),
             booking::reservation->search_where( { id => $circ, return_time => undef, cancel_time => undef } );
     } else {
-        push @circs, overdue_circs();
+        push @circs, overdue_circs(undef, 1, 1);
     }
 
     my %hoo = map { ( $_->id => $_ ) } actor::org_unit::hours_of_operation->retrieve_all;
 
     my $penalty = OpenSRF::AppSession->create('open-ils.penalty');
+    my $handling_resvs = 0;
     for my $c (@circs) {
 
         my $ctype = ref($c);
+
+        if (!$ctype) { # fetched via idlist
+            if ($handling_resvs) {
+                $c = booking::reservation->retrieve($c);
+            } elsif (not defined $c) {
+                # an undef value is the indicator that we are moving
+                # from processing circulations to reservations.
+                $handling_resvs = 1;
+                next;
+            } else {
+                $c = action::circulation->retrieve($c);
+            }
+            $ctype = ref($c);
+        }
+
         $ctype =~ s/^.+::(\w+)$/$1/;
     
         my $due_date_method = 'due_date';

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Publisher/action.pm        |   51 ++++++++++++++++++--
 1 files changed, 46 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list