about summary refs log tree commit diff
path: root/sourcecodes
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-10-03 12:13:38 +0000
committerPjotr <wrk@bosa.lan>2026-10-03 12:13:38 +0000
commitf9d5c4116711d6fd82f2a8cf55acc10bf36ab740 (patch)
tree410a4d83ca12238abb1baf959c8284ee4029b842 /sourcecodes
parent605900ddc699017695f9c93ab5a58a8100a4bf30 (diff)
downloadgn-bnw-f9d5c4116711d6fd82f2a8cf55acc10bf36ab740.tar.gz
run.sh: self-locate the C binaries; fix the production run failure
run.sh cd'ed to /var/lib/genenet/bnw and ran ./network_score etc
RELATIVE to that directory -- depending on the activation having
copied the binaries there.  On production that copy was incomplete
(the binaries live in the bnw PACKAGE store item since 00e5b05f
removed the vendored ones and build.sh recompiles them), so every
structure-learning run died with "./network_score: No such file or
directory".

run.sh now locates the binaries next to itself:
  BNW_BIN_DIR=$(dirname $0)/../var_lib_genenet_bnw
which in the package is <out>/sourcecodes/../var_lib_genenet_bnw --
provably present in the store item.  The per-run working directory
stays /var/lib/genenet/bnw.
Diffstat (limited to 'sourcecodes')
-rwxr-xr-xsourcecodes/run.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/sourcecodes/run.sh b/sourcecodes/run.sh
index 344b7591..9b4e6e2d 100755
--- a/sourcecodes/run.sh
+++ b/sourcecodes/run.sh
@@ -3,6 +3,17 @@
 #ess=1
 #DIR="$d/data/$1"
 #DIR_1="$d/data/$1/"
+
+# The C binaries (network_score, structure, k-best/...) are deployed
+# with THIS script in the bnw package: <package>/sourcecodes/run.sh and
+# <package>/var_lib_genenet_bnw/{network_score,structure,k-best,...}.
+# They are self-locating via the script's own directory, so the flow
+# works regardless of what /var/lib/genenet/bnw contains (an earlier
+# version cd'ed there and depended on activation having copied the
+# binaries -- on production that copy was incomplete and the run died
+# with "./network_score: No such file or directory").
+BNW_BIN_DIR="$(cd "$(dirname "$0")/.." && pwd)/var_lib_genenet_bnw"
+
 cd /var/lib/genenet/bnw
 
 
@@ -12,11 +23,11 @@ maxparent=$2
 k=$3
 THR=$4
 
-./network_score /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1ban.txt /var/lib/genenet/bnw/$1white.txt $maxparent /var/lib/genenet/bnw/$1
+"$BNW_BIN_DIR/network_score" /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1ban.txt /var/lib/genenet/bnw/$1white.txt $maxparent /var/lib/genenet/bnw/$1
 
-./k-best/src/data2netk_poster.sh /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1 $k $maxparent
+"$BNW_BIN_DIR/k-best/src/data2netk_poster.sh" /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1 $k $maxparent
 
-./structure /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1/postProbEachEdge.txt /var/lib/genenet/bnw/$1structure_input_temp.txt /var/lib/genenet/bnw/$1structure_input.txt $THR
+"$BNW_BIN_DIR/structure" /var/lib/genenet/bnw/$1continuous_input.txt /var/lib/genenet/bnw/$1/postProbEachEdge.txt /var/lib/genenet/bnw/$1structure_input_temp.txt /var/lib/genenet/bnw/$1structure_input.txt $THR
 
 rm -r /var/lib/genenet/bnw/$1