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 08:41:43 +0000
committerPjotr <wrk@bosa.lan>2026-10-03 08:41:43 +0000
commit1de3cbe0d94ef024945661f3c9d574e3990183c4 (patch)
tree6dcc8040b129e310e94f6d7926941371b54ab3ce /sourcecodes/execute_bn_gom.php
parentdd8dc307a2c991afdfa953a2f1733379a54f5d8e (diff)
downloadgn-bnw-1de3cbe0d94ef024945661f3c9d574e3990183c4.tar.gz
execute_bn_gom: show a status page while structure learning runs
The runner page used to output NOTHING until the C structure learning
and octave runs finished (~12s+); the browser sat on a blank page and
only then got the window.open forward to the network diagram.  Emit a
status page first (flushed before the work starts):

  Structure learning is running.
  Forwarding to the network diagram when done...
  If the diagram does not open, click here.   (link to
  layout_svg_no.php?My_key=...)

so users get feedback during the run and a manual fallback if the
automatic forward is blocked or fails.
Diffstat (limited to 'sourcecodes/execute_bn_gom.php')
-rw-r--r--sourcecodes/execute_bn_gom.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/sourcecodes/execute_bn_gom.php b/sourcecodes/execute_bn_gom.php
index 66a04e01..113841cc 100644
--- a/sourcecodes/execute_bn_gom.php
+++ b/sourcecodes/execute_bn_gom.php
@@ -5,6 +5,27 @@ require("terminal_commands.php");
 
 $keyval=valid_keyval($_GET["My_key"]);
 
+// Structure learning takes a while (C code + octave) and this page
+// used to output NOTHING until it was done -- the browser sat on a
+// blank page.  Emit the status page FIRST and flush it, so the user
+// sees what is happening, with a fallback link in case the automatic
+// forward is blocked or fails.
+?>
+<!doctype html>
+<html>
+<head>
+<title>Running BNW</title>
+<link rel="stylesheet" type="text/css" href="my_new_style.css">
+</head>
+<body>
+<div class="content">
+<p>Structure learning is running.</p>
+<p id="bnw-forwarding">Forwarding to the network diagram when done&hellip;</p>
+<p>If the diagram does not open, <a href="layout_svg_no.php?My_key=<?php print($keyval);?>">click here</a>.</p>
+</div>
+<?php
+flush();
+
 //////////////execute c codes for local score///////////////////
 //$dir="/var/lib/genenet/bnw/";
 $dir="/var/lib/genenet/bnw/";
@@ -98,4 +119,6 @@ runTerminalCommand([realpath(__DIR__.'/run_scripts/run_octave'), $keyval]);
 <script>
 window.open("layout_svg_no.php?My_key=<?php print($keyval);?>",'_self',false);
 </script>
+</body>
+</html>