Bugzilla – Attachment 113780 Details for
Bug 27048
Add timestamps to verbose output of rebuild_zebra.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27048: Add basic timekeeping to rebuild_zebra
Bug-27048-Add-basic-timekeeping-to-rebuildzebra.patch (text/plain), 4.03 KB, created by
Martin Renvoize (ashimema)
on 2020-11-18 12:01:03 UTC
(
hide
)
Description:
Bug 27048: Add basic timekeeping to rebuild_zebra
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-11-18 12:01:03 UTC
Size:
4.03 KB
patch
obsolete
>From 2377a5df713824e1bdba84d4b1b5d6d72fc8f408 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 18 Nov 2020 10:36:43 +0000 >Subject: [PATCH] Bug 27048: Add basic timekeeping to rebuild_zebra > >This patch adds a start time, end time and elapsed times on the 'records >exported' lines to the verbose output of the rebuild_zebra.pl script. > >Test plan >1/ Run rebuild_zebra.pl -a -b -v >2/ Note the new timestamps included on the verbose output >3/ Signoff >--- > misc/migration_tools/rebuild_zebra.pl | 35 +++++++++++++++++++++++---- > 1 file changed, 30 insertions(+), 5 deletions(-) > >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index cb42164e06..8fd611a83b 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -209,7 +209,9 @@ if( !defined $LockFH ) { > # the lockfile) > }; > >+my $start_time = time(); > if ( $verbose_logging ) { >+ my $pretty_time = POSIX::strftime("%H:%M:%S",localtime($start_time)); > print "Zebra configuration information\n"; > print "================================\n"; > print "Zebra biblio directory = $biblioserverdir\n"; >@@ -219,6 +221,7 @@ if ( $verbose_logging ) { > print "BIBLIONUMBER in : $biblionumbertagfield\$$biblionumbertagsubfield\n"; > print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n"; > print "================================\n"; >+ print "Job started: $pretty_time\n"; > } > > my $tester = XML::LibXML->new(); >@@ -267,6 +270,8 @@ if ($daemon_mode) { > > > if ( $verbose_logging ) { >+ print "====================\n"; >+ print "Indexing complete: ". pretty_time() . "\n"; > print "====================\n"; > print "CLEANING\n"; > print "====================\n"; >@@ -362,7 +367,7 @@ sub index_records { > } else { > if ( $verbose_logging ) { > print "====================\n"; >- print "exporting $record_type\n"; >+ print "exporting $record_type " . pretty_time() . "\n"; > print "====================\n"; > } > mkdir "$directory" unless (-d $directory); >@@ -403,7 +408,7 @@ sub index_records { > } else { > if ( $verbose_logging ) { > print "====================\n"; >- print "REINDEXING zebra\n"; >+ print "REINDEXING zebra " . pretty_time() . "\n"; > print "====================\n"; > } > my $record_fmt = 'marcxml'; >@@ -556,7 +561,7 @@ sub export_marc_records_from_sth { > } > } > } >- print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); >+ print "\nRecords exported: $num_exported " . pretty_time() . "\n" if ( $verbose_logging ); > print {$fh} $marcxml_close; > > close $fh; >@@ -593,7 +598,7 @@ sub export_marc_records_from_list { > } > } > } >- print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); >+ print "\nRecords exported: $num_exported " . pretty_time() . "\n" if ( $verbose_logging ); > > print {$fh} $marcxml_close; > >@@ -632,7 +637,7 @@ sub generate_deleted_marc_records { > > $records_deleted->{$record_number} = 1; > } >- print "\nRecords exported: $i\n" if ( $verbose_logging ); >+ print "\nRecords exported: $i " . pretty_time() . "\n" if ( $verbose_logging ); > > print {$fh} $marcxml_close; > >@@ -826,6 +831,26 @@ sub _create_lockfile { #returns undef on failure > return ( $fh, $dir.'/'.LOCK_FILENAME ); > } > >+sub pretty_time { >+ use integer; >+ my $now = time; >+ my $elapsed = $now - $start_time; >+ local $_ = $elapsed; >+ my ( $d, $h, $m, $s ); >+ $s = $_ % 60; >+ $_ /= 60; >+ $m = $_ % 60; >+ $_ /= 60; >+ $h = $_ % 24; >+ $_ /= 24; >+ $d = $_; >+ >+ my $now_pretty = POSIX::strftime("%H:%M:%S",localtime($now)); >+ my $elapsed_pretty = $d ? "[$d:$h:$m:$s]" : $h ? "[$h:$m:$s]" : $m ? "[$m:$s]" : "[$s]"; >+ >+ return "$now_pretty $elapsed_pretty"; >+} >+ > sub print_usage { > print <<_USAGE_; > $0: reindex MARC bibs and/or authorities in Zebra. >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27048
:
113773
|
113780
|
115931
|
117201
|
117418
|
117452
|
117617