Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apps/common_files/copy_paste_help.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<details>
<summary>copy-paste help</summary>
<ul>
<li>Select &amp; Copy to Clipboard</li>
<ul>
<li>Line: <b>Shift+Left Click &amp; Drag</b></li>
<li>Block: <b>Shift+Alt+Left Click &amp; Drag</b></li>
</ul>
<li>Paste From Clipboard</li>
<ul>
<li><b>Shift+Insert</b></li>
<li><b>Ctrl+Shift+V</b></li>
</ul>
</ul>
</details>
15 changes: 3 additions & 12 deletions apps/interactive-shell/view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@
<button class="btn btn-primary" type="submit">
<i class="fa fa-eye"></i> Connect to Shell
</button>

<%= ERB.new(File.read('../common_files/copy_paste_help.sh.erb'), eoutvar: 'child').result(binding) %>

</form>
<ul>
<li>Select &amp; Copy to Clipboard</li>
<ul>
<li>Line: <b>Shift+Left Click &amp; Drag</b></li>
<li>Block: <b>Shift+Alt+Left Click &amp; Drag</b></li>
</ul>
<li>Paste From Clipboard</li>
<ul>
<li><b>Shift+Insert</b></li>
<li><b>Ctrl+Shift+V</b></li>
</ul>
</ul>
53 changes: 53 additions & 0 deletions apps/slicernninteractive/form.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
cluster: "*"

# app-specific attributes
attributes:
bc_num_hours:
label: "Number of hours"
widget: "number_field"
value: 12
min: 1
max: 120
step: 1
advanced_font_size:
label: Font Size
help: |
Default terminal (xterm.js) font size.

- Dynamic font/zoom adjustments via Ctrl+(Plus|Minux|0) has UI bugs.
- To change font size, cancel your running interactive shell session and launch a new job with the desired font size.
widget: number_field
max: 30
min: 10
step: 1
value: 16
advanced_tmux_config:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naive question, why is tmux needed? is this a shell application with a TUI interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the interactive shell is not needed, it's only there because the user wants to monitor the log from a terminal.

label: "Tmux: Use Bundled Config File"
help: |
- Checked = load config included with this interactive app
- Unchecked = No config file is specified and Tmux will look in the default locations (usually <code>$HOME/.tmux.conf</code>)
- Ensure your config file is compatible with Tmux 3.1b!
widget: check_box
value: "1"
working_dir:
label: "Model weights directory"
help: |
- Optionally select a nnInteractive model weights directory.
- Default = <code>/apps/brussel/singularity/nninteractive-slicer-server/20250404/weights</code>
widget: "path_selector"
show_files: false


form:
- auto_queues
- global_num_cores
- bc_num_slots
- global_bc_num_gpu_slots
- bc_num_hours
- working_dir
- global_prerun
- global_advanced
- advanced_font_size
- advanced_tmux_config
- bc_email_on_started
Binary file added apps/slicernninteractive/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/slicernninteractive/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: SlicerNNInteractive Server
category: Interactive Apps
subcategory: Testing
role: batch_connect
description: |
Launch an SlicerNNInteractive Server on the compute nodes.
18 changes: 18 additions & 0 deletions apps/slicernninteractive/submit.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
#
# Configure the content of the job script for the batch job here
# @see http://www.rubydoc.info/gems/ood_core/OodCore/BatchConnect/Template
#
batch_connect:
# We use the basic web server template for generating the job script
#
# @note Do not change this unless you know what you are doing!
template: "basic"
conn_params:
- app_server_port


script:
native:
- "--cpus-per-task=<%= global_num_cores.to_i %>"
- "--gpus-per-node=<%= global_bc_num_gpu_slots.blank? ? 0 : global_bc_num_gpu_slots.to_i %>"
1 change: 1 addition & 0 deletions apps/slicernninteractive/template/after.sh.erb
26 changes: 26 additions & 0 deletions apps/slicernninteractive/template/before.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<%= ERB.new(File.read('../common_files/ood_session.sh.erb'), eoutvar: 'child').result(binding) %>

<%
if defined?(context.working_dir)
working_dir = context.working_dir
else
working_dir = ""
end
if working_dir.blank?
working_dir = '/apps/brussel/singularity/nninteractive-slicer-server/20250404/weights'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this directory is not writable by the user

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, the weights are pre-downloaded in this location, and the server expects to find them in the cwd.

end
%>

# Set User Defined Working Directory
export OOD_WD="<%= working_dir.to_s %>"
echo "working dir: $OOD_WD"

<%= ERB.new(File.read('../common_files/job_environment.sh.erb'), eoutvar: 'child').result(binding) %>

export OOD_APP_NAME="SlicerNNInteractive Server"

while true; do
app_server_port=$(find_port $host)
[[ $app_server_port -ne $port ]] && break
done
export app_server_port
11 changes: 11 additions & 0 deletions apps/slicernninteractive/template/script.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/bash -l

<%= ERB.new(File.read('../common_files/work_directory_change.sh.erb'), eoutvar: 'child').result(binding) %>

[[ -z $APPTAINERENV_HF_HUB_OFFLINE ]] && export APPTAINERENV_HF_HUB_OFFLINE=1

apptainer run --nv \
/apps/brussel/singularity/nninteractive-slicer-server/20250404/nninteractive-slicer-server-20250404.sif \
python /opt/server/main.py --host 127.0.0.1 --port $app_server_port 2>&1 | tee /tmp/server.log &

<%= ERB.new(File.read('../common_files/launch_ttyd_tmux.sh.erb'), eoutvar: 'child').result(binding) %>
1 change: 1 addition & 0 deletions apps/slicernninteractive/template/tmux.conf
23 changes: 23 additions & 0 deletions apps/slicernninteractive/view.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<%
# generate form id, based on host and port
require 'digest'
form_id = Digest::SHA1.hexdigest("--" + host.to_s + "--" + port.to_s + "--")
%>
<script type="text/javascript">
function get_<%= form_id %>_action(form) {
form.action = "https://" + window.location.host + "/node/<%= host %>/<%= port %>/?arg=<%= password %>"
}
</script>
<form id="<%= form_id %>" method="post" target="_blank" onsubmit="get_<%= form_id %>_action(this)">
<button class="btn btn-primary" type="submit">
<i class="fa fa-eye"></i> Connect to Shell
</button>

<%= ERB.new(File.read('../common_files/copy_paste_help.sh.erb'), eoutvar: 'child').result(binding) %>

<ul>
<li>Server log file: <code>/tmp/server.log</code></li>
<li>SSH tunnel: <code>ssh <%= host %> -NL 127.0.0.1:<%= app_server_port %>:127.0.0.1:<%= app_server_port %> -J <%= CurrentUser.name %>@login.hpc.vub.be</code></li>
<li>Server URL: <code>http://127.0.0.1:<%= app_server_port %></code></li>
</ul>
</form>
4 changes: 3 additions & 1 deletion ondemand-vub.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Summary: Scripts, customizations and tools for Open OnDemand
Name: ondemand-vub
Version: 2.01
Version: 2.02
Release: 1
BuildArch: noarch
License: GPL
Expand Down Expand Up @@ -57,6 +57,8 @@ Scripts, customizations and tools for Open OnDemand as used at the VUB.
/var/www/ood/apps/sys

%changelog
* Thu Oct 09 2025 Samuel Moors <[email protected]>
- Add SlicerNNInteractive Server app
* Mon Sep 29 2025 Samuel Moors <[email protected]>
- Set graphics backend
* Thu Jul 10 2025 Alex Domingo <[email protected]>
Expand Down