about summary refs log tree commit diff
path: root/sourcecodes/execute_bn_gom.php
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-10-03 09:26:58 +0000
committerPjotr <wrk@bosa.lan>2026-10-03 09:26:58 +0000
commite18ba4152a149314bbe14d25d736fbaf8c841346 (patch)
tree9178dd58517e289e108d606d3de651cda5d9b50a /sourcecodes/execute_bn_gom.php
parent1de3cbe0d94ef024945661f3c9d574e3990183c4 (diff)
downloadgn-bnw-e18ba4152a149314bbe14d25d736fbaf8c841346.tar.gz
execute_bn_gom: show pipeline failures on the status page
runTerminalCommand throws a RuntimeException when run.sh or
run_octave fails, and execute_bn_gom.php had no try/catch -- the
uncaught exception produced a blank page with no forward and no
diagnosis (observed on production with real GeneNetwork datasets).
Wrap the structure-learning pipeline in try/catch and render the
error on the status page ("Structure learning FAILED: ..." plus a
link back to the upload page) instead.
Diffstat (limited to 'sourcecodes/execute_bn_gom.php')
-rw-r--r--sourcecodes/execute_bn_gom.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/sourcecodes/execute_bn_gom.php b/sourcecodes/execute_bn_gom.php
index 113841cc..3ff3f6e0 100644
--- a/sourcecodes/execute_bn_gom.php
+++ b/sourcecodes/execute_bn_gom.php
@@ -48,6 +48,8 @@ $thr=file_get_contents("$thrfile");
 //$thr=valid_input($thr);
 $thr=trim($thr);
 
+$bnw_error = NULL;
+try {
 runTerminalCommand([realpath(__DIR__).'/run.sh', $keyval, $maxp, $maxk, $thr]);
 
 /////////////////////////////////structure matrix//////////////////////////////////////////////////////////
@@ -114,6 +116,24 @@ if ($fout !== false) {
 
 
 runTerminalCommand([realpath(__DIR__.'/run_scripts/run_octave'), $keyval]);
+} catch (Exception $e) {
+   $bnw_error = $e->getMessage();
+}
+
+if(!is_null($bnw_error))
+{
+   // Structure learning failed: show it on the status page instead of
+   // a blank fatal error page with no forward.
+   ?>
+   <p style="color: red;">Structure learning FAILED:</p>
+   <pre><?php print(htmlspecialchars($bnw_error)); ?></pre>
+   <p><a href="bn_genenet.php">Back to the data upload page</a></p>
+   </div>
+   </body>
+   </html>
+   <?php
+   exit(1);
+}
 
 ?>
 <script>