From 0d456ca182a1c81d04e5c0f487bb899060277f97 Mon Sep 17 00:00:00 2001 From: Andreas Thalhammer Date: Mon, 8 Apr 2024 21:11:17 +0200 Subject: [PATCH] introduced fast forward/resume --- danker/danker.py | 6 ++++-- script/create_links.sh | 10 +++++++++- script/dank.sh | 1 - 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/danker/danker.py b/danker/danker.py index 0abe1ba..c3da266 100755 --- a/danker/danker.py +++ b/danker/danker.py @@ -80,6 +80,7 @@ """ import sys import time +import datetime import argparse # import memory_profiler @@ -333,7 +334,7 @@ def _main(): sys.exit(1) print( f"danker: starting computation of PageRank on '{args.left_sorted}' with parameters\n\t" - f"{param_out}", + f"{param_out} ({datetime.datetime.now()})", file=sys.stderr, ) start = time.time() @@ -356,7 +357,8 @@ def _main(): danker_bigmem(dictionary, args.iterations, args.damping) print( - "danker: PageRank computation took " f"{time.time() - start:.2f} seconds.", + "danker: PageRank computation took " + f"{time.time() - start:.2f} seconds ({datetime.datetime.now()}).", file=sys.stderr, ) diff --git a/script/create_links.sh b/script/create_links.sh index 8b5ea2e..290e6d1 100755 --- a/script/create_links.sh +++ b/script/create_links.sh @@ -30,7 +30,7 @@ while getopts ":d:f:k" a; do f) folder=${OPTARG} ;; - k) + k) keep_site_links=1 ;; *) @@ -111,6 +111,14 @@ if [ ! "$dump_date" ]; then dump_date=$(latest_dump) || exit 1 fi +# Skip if file exists +if [ -f "$wiki-$dump_date"".links" ]; then + echo "$wiki-$dump_date.links exists... skipping" 1>&2 + echo "$wiki-$dump_date"".links" + exit 0 +fi + + # File names are now fully specified page="$wiki-""$dump_date""-page.sql" pagelinks="$wiki-""$dump_date""-pagelinks.sql" diff --git a/script/dank.sh b/script/dank.sh index c4e44b1..ffb83de 100755 --- a/script/dank.sh +++ b/script/dank.sh @@ -15,7 +15,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -e # Check for environment variables for sort if [ -z ${MEM_PERC+x} ]; then