Hi Jeff, thank you very much for the swift response.
I don’t think my issue is caused by back-grounding. I do have the additional commands in my script.sh.erb to check the stata PID, and use ‘sleep’ to keep the job going. You can see in the output.log that this works for a bit, but the stata process disappears fairly quickly - full output.log below:
Setting VNC password…
Starting VNC server…
Desktop ‘TurboVNC: comp033.int.ada.nottingham.ac.uk:1 (cczcb)’ started on display comp033.int.ada.nottingham.ac.uk:1
Log file is vnc.log
Successfully started VNC server on comp033.int.ada.nottingham.ac.uk:5901…
Script starting…
Starting websocket server…
The system default contains no modules
(env var: LMOD_SYSTEM_DEFAULT_MODULES is empty)
No changes in loaded modules
(xfwm4:3563098): GLib-CRITICAL **: 09:44:56.529: g_str_has_prefix: assertion ‘prefix != NULL’ failed
WebSocket server settings:
- Listen on :20815
- No SSL/TLS support (no cert file)
- Backgrounding (daemon)
Scanning VNC log file for user authentications…
Generating connection YAML file…
Currently Loaded Modules:
- stata-uoneasy/8/18
DISPLAY is :1
Current directory is /gpfs01/home/cczcb
++ xstata-mp
+++ pgrep -u cczcb xstata-mp
+++ tail
++ stata_pid=3563143
++ [[ -d /proc/3563143 ]]
++ sleep 1
++ [[ -d /proc/3563143 ]]
++ sleep 1
++ [[ -d /proc/3563143 ]]
++ sleep 1
++ [[ -d /proc/3563143 ]]
++ sleep 1
++ [[ -d /proc/3563143 ]]
Cleaning up…
Killing Xvnc process ID 3563068
xsetroot: unable to open display ‘:1’
Unable to init server: Could not connect: Connection refused
(xfsettingsd:3563242): xfsettingsd-ERROR **: 09:45:03.810: Unable to open display.
/gpfs01/home/cczcb/ondemand/data/sys/dashboard/batch_connect/sys/test-application-3/output/f9c1d170-cd86-41f2-9b5a-fed04018839c/script.sh: line 18: 3563242 Trace/breakpoint trap (core dumped) xfsettingsd --sm-client-disable
Unable to init server: Could not connect: Connection refused
xfce4-panel: Cannot open display: .
Type “xfce4-panel --help” for usage.
For my version of Stata (18), there is an option for command xstata-mp which is supposed to set it to notfork to background. If I try this, the Stata process ends even sooner, so no PID is recorded. This time, there is a ‘terminated’ message:
Currently Loaded Modules:
- stata-uoneasy/8/18
DISPLAY is :1
Current directory is /gpfs01/home/cczcb
++ xstata-mp -f0
/gpfs01/home/cczcb/ondemand/data/sys/dashboard/batch_connect/sys/test-application-3/output/0fd08c9a-d0c2-4a78-94e9-803e7fb85fe2/script.sh: line 36: 3568166 Terminated xstata-mp -f0
+++ pgrep -u cczcb xstata-mp
+++ tail
++ stata_pid=
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
Setting VNC password…
Generating connection YAML file…
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
++ sleep 1
++ [[ -d /proc/ ]]
It does seem the VNC desktop loads something that is needed for Stata to run on our system compute nodes, which the interactive application lacks. The script.sh.erb is a bit different from the one from the repository, but seems to do pretty much the same. It does work fine for other applications, e.g. MATLAB. Below is the version used for latest test:
#
# Launch Xfce Window Manager and Panel
#
(
export SEND_256_COLORS_TO_REMOTE=1
# It will override without replacing any XFCE settings that the user
# already has.
export XDG_CONFIG_HOME=“<%= session.staged_root.join(“config”) %>”
export XDG_DATA_HOME=“<%= session.staged_root.join(“share”) %>”
export XDG_CACHE_HOME=“$(mktemp -d)”
module restore
eval $(dbus-launch --sh-syntax)
xfwm4 --compositor=off --sm-client-disable
xsetroot -solid “#D3D3D3”
xfsettingsd --sm-client-disable
xfce4-panel --sm-client-disable
) &
cd “$HOME”
#
# Start application
#
# Load the required environment
module load <%= context.stata_version %>
#module load mesa-uoneasy/23.1.9-GCCcore-13.2.0
# make sure that XFCE boots up before you do
sleep 3
# Launch application
module list # List loaded modules for debugging purposes
echo “DISPLAY is $DISPLAY”
echo “Current directory is $PWD”
set -x
xstata-mp -f0
# Get the PID of the last xstata-mp process started that $USER owns
stata_pid=$( pgrep -u “$USER” ‘xstata-mp’ | tail )
# As long as the PID directory exists we wait
while [[ -d “/proc/$stata_pid” ]]; do
sleep 1
done
#sleep 120
Most grateful for any further thoughts.
Colin