Skip to content

Commit

Permalink
added parameters, computation output, and output length to stats
Browse files Browse the repository at this point in the history
  • Loading branch information
athalhammer committed Nov 22, 2023
1 parent 3961313 commit 104f1bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 8 additions & 4 deletions danker/danker.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def _main():
"-i", "--int_only", action="store_true", help="All nodes are integers (flag)"
)
args = parser.parse_args()
param_out = f"[iterations ({args.iterations}), damping ({args.damping}), start value({args.start_value})]"
if (
args.iterations < 0
or args.damping > 1
Expand All @@ -325,12 +326,16 @@ def _main():
):
print(
"ERROR: Provided PageRank parameters\n\t"
f"[iterations ({args.iterations}), damping ({args.damping}), "
f"start value({args.start_value})]\n\tout of allowed range.\n\n",
f"{param_out}\n\tout of allowed range.\n\n",
file=sys.stderr,
)
parser.print_help(sys.stderr)
sys.exit(1)
print(
f"danker: starting computation of PageRank on '{args.left_sorted}' with parameters\n\t"
f"{param_out}",
file=sys.stderr,
)
start = time.time()
dictionary = init(
args.left_sorted, args.start_value, args.right_sorted, args.int_only
Expand All @@ -351,8 +356,7 @@ def _main():
danker_bigmem(dictionary, args.iterations, args.damping)

print(
f"Computation of PageRank on '{args.left_sorted}' with danker took "
f"{time.time() - start:.2f} seconds.",
"danker: PageRank computation took " f"{time.time() - start:.2f} seconds.",
file=sys.stderr,
)

Expand Down
11 changes: 7 additions & 4 deletions script/dank.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ fi

if [ "$1" == "ALL" ]; then
filename=$(date +"%Y-%m-%d").all"$project".links
> "$filename.files.txt"
> "$filename.stats.txt"
if languages=$(./script/get_languages.sh "$project"); then

# collect
Expand All @@ -79,7 +81,6 @@ if [ "$1" == "ALL" ]; then

# collect stats
xargs wc -l < "$filename.files.txt" | grep -v "total" | sed "s/^[[:space:]]\+//" > "$filename.stats.txt"
wc -l "$filename" >> "$filename.stats.txt"

# clean up
xargs rm < "$filename.files.txt"
Expand All @@ -90,25 +91,27 @@ if [ "$1" == "ALL" ]; then
fi
else
filename=$(./script/create_links.sh "$1" "$project" "$dump_time" "$folder")
> "$filename.stats.txt"
fi

# "extract links only" option
if [ "$links" ]; then
echo "$filename"
exit 0
fi
wc -l "$filename" >> "$filename.stats.txt"

if [ "$bigmem" ]; then
python3 -m danker "$filename" "$damping" "$iterations" "$start_value" -i \
| sed "s/\(.*\)/Q\1/" \
2>> "$filename.stats.txt" | sed "s/\(.*\)/Q\1/" \
> "$filename".rank
else
sort -k 2,2n -T . -S "$MEM_PERC" -o "$filename"".right" "$filename"
python3 -m danker "$filename" -r "$filename"".right" "$damping" "$iterations" "$start_value" -i \
| sed "s/\(.*\)/Q\1/" \
2>> "$filename.stats.txt" | sed "s/\(.*\)/Q\1/" \
> "$filename".rank
rm "$filename"".right"
fi
sort -k 2,2nr -T . -S "$MEM_PERC" -o "$filename"".rank" "$filename"".rank"
wc -l "$filename"".rank" >> "$filename.stats.txt"
bzip2 "$filename"
wc -l "$filename"".rank"

0 comments on commit 104f1bb

Please sign in to comment.