This repository has been archived by the owner on Jan 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·72 lines (60 loc) · 1.54 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
pid1=
pid2=
logistic_regression_args=""
test -f target/logistic-regression-jar-with-dependencies.jar || mvn package
if [[ -z "$1" || "$1" == "--help" || "$1" == "-h" ]]; then
java -jar target/logistic-regression-jar-with-dependencies.jar --help
echo
echo "Run script usage:"
echo
echo " $0 <dataset> <options>"
echo
echo "where <options> are the options described above."
echo
echo "Example: $0 mtcars --privacy-budget 1"
echo
echo "Available datasets:"
echo " mtcars"
echo " breast_cancer"
exit 1
fi
echo "Started at $(date)"
ctrl_c() {
echo "CTRL-C: cleanup $pid1 and $pid2"
kill -9 $pid1
kill -9 $pid2
exit 1
}
main() {
trap ctrl_c INT
dataset=$1
shift
out1File=$(mktemp)
out2File=$(mktemp)
java \
-jar target/logistic-regression-jar-with-dependencies.jar \
-p1:localhost:8871 \
-p2:localhost:8872 \
$* \
-i1 < "target/classes/${dataset}_party1.txt" > ${out1File} 2> party1.log &
pid1=$!
java \
-jar target/logistic-regression-jar-with-dependencies.jar \
-p1:localhost:8871 \
-p2:localhost:8872 \
$* \
-i2 < "target/classes/${dataset}_party2.txt" > ${out2File} 2> party2.log &
pid2=$!
wait
out1=$(cat ${out1File})
out2=$(cat ${out2File})
if [[ "${out1}" != "${out2}" ]]; then
echo "Output is not the same!"
echo "Party 1: ${out1}"
echo "Party 2: ${out2}"
else
echo "Output: ${out1}"
fi
}
time main $*