Skip to content
Snippets Groups Projects
Commit 223cab8d authored by Matthew K Defenderfer's avatar Matthew K Defenderfer
Browse files

overwrite with Cheaha's OOD Desktop app

parent c3fc86fc
No related branches found
No related tags found
No related merge requests found
# Batch Connect - Desktop
This app is distributed as a part of Open OnDemand. Read https://osc.github.io/ood-documentation/latest/enable-desktops.html
for instructions on how to configure it.
\ No newline at end of file
![GitHub Release](https://img.shields.io/github/release/osc/bc_desktop.svg)
[![GitHub License](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)
A Batch Connect app designed to launch a GUI desktop withing a batch job.
## Prerequisites
This Batch Connect app requires the following software be installed on the
**compute nodes** that the batch job is intended to run on (**NOT** the
OnDemand node).
One of the following desktops:
- [Xfce Desktop] 4+
- [Mate Desktop] 1+ (*default*)
- [Gnome Desktop] 2 (currently we do not support Gnome 3)
For VNC server support:
- [TurboVNC] 2.1+
- [websockify] 0.8.0+
For hardware rendering support:
- [X server]
- [VirtualGL] 2.3+
[Xfce Desktop]: https://xfce.org/
[Mate Desktop]: https://mate-desktop.org/
[Gnome Desktop]: https://www.gnome.org/
[TurboVNC]: http://www.turbovnc.org/
[websockify]: https://github.com/novnc/websockify
[X server]: https://www.x.org/
[VirtualGL]: http://www.virtualgl.org/
## Install
Use git to clone this app and checkout the desired branch/version you want to
use:
```sh
scl enable git19 -- git clone <repo>
cd <dir>
scl enable git19 -- git checkout <tag/branch>
```
You will not need to do anything beyond this as all necessary assets are
installed. You will also not need to restart this app as it isn't a Passenger
app.
To update the app you would:
```sh
cd <dir>
scl enable git19 -- git fetch
scl enable git19 -- git checkout <tag/branch>
```
Again, you do not need to restart the app as it isn't a Passenger app.
## Configuration
Please see the [Install Desktops] section in the [Open OnDemand Documentation]
to learn more about setting up and configuring a desktop at your HPC center.
[Install Desktops]: https://osc.github.io/ood-documentation/master/enable-desktops.html
[Open OnDemand Documentation]: https://osc.github.io/ood-documentation/master/index.html
## Contributing
1. Fork it ( https://github.com/OSC/bc_desktop/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
v0.2.2
\ No newline at end of file
const table = {
"interactive": { "max_cpu": 48, "max_hour": 2, "max_gpu": -1 },
"express": { "max_cpu": 48, "max_hour": 2, "max_gpu": -1 },
"short": { "max_cpu": 48, "max_hour": 12, "max_gpu": -1 },
"pascalnodes": { "max_cpu": 28, "max_hour": 12, "max_gpu": 4 },
"pascalnodes-medium": { "max_cpu": 28, "max_hour": 48, "max_gpu": 4 },
"medium": { "max_cpu": 48, "max_hour": 50, "max_gpu": -1 },
"long": { "max_cpu": 48, "max_hour": 150, "max_gpu": -1 },
"intel-dcb": { "max_cpu": 24, "max_hour": 150, "max_gpu": -1 },
"amd-hdr100": { "max_cpu": 128, "max_hour": 150, "max_gpu": -1 },
"largemem": { "max_cpu": 24, "max_hour": 50, "max_gpu": -1 },
"largemem-long": { "max_cpu": 24, "max_hour": 150, "max_gpu": -1 },
"amperenodes": { "max_cpu": 128, "max_hour": 12, "max_gpu": 2 },
"amperenodes-medium": { "max_cpu": 128, "max_hour": 48, "max_gpu": 2 },
}
function set_max_value(form_id, value) {
const form_element = $(form_id);
form_element.attr({'max': value});
}
function set_partition_change_handler() {
let partition_select = $("#batch_connect_session_context_bc_partition");
partition_select.change( function(e) {
toggle_gpu_visibility(e);
});
}
function toggle_gpu_visibility(event) {
const partition = event.target.value;
const cpu_selector = '#batch_connect_session_context_bc_num_slots';
const gpu_selector = '#batch_connect_session_context_bc_num_gpus';
const hour_selector = '#batch_connect_session_context_bc_num_hours';
toggle_visibilty_of_form_group(gpu_selector, table[partition]["max_gpu"] != -1);
set_max_value(cpu_selector, table[partition]["max_cpu"]);
set_max_value(gpu_selector, table[partition]["max_gpu"]);
set_max_value(hour_selector, table[partition]["max_hour"]);
}
function toggle_visibilty_of_form_group(form_id, show) {
let form_element = $(form_id);
let parent = form_element;
while (
(! parent[0].classList.contains('form-group')) &&
(! parent.is('html')) // ensure that we don't loop infinitely
) {
parent = parent.parent();
}
// If parent is HTML then something has gone wrong and visibility should not be changed
if ( parent.is('html') ) {
return;
}
if(show) {
parent.show();
} else {
parent.hide();
}
}
toggle_gpu_visibility(
// Fake the event
{ target: document.querySelector('#batch_connect_session_context_bc_partition') }
);
set_partition_change_handler();
---
attributes:
desktop:
label: "Desktop Environment"
widget: select
options:
- "gnome"
- "kde"
- "mate"
- "xfce"
desktop: "mate"
bc_vnc_idle: 0
bc_vnc_resolution:
required: true
......
<%-
email = ENV['USER']
if !email.include? '@'
email = email + '@uab.edu'
end
-%>
---
script:
job_environment:
USER: "<%= ENV['USER'] %>"
native:
- "-N 1"
- "-n <%= bc_num_slots.blank? ? 1 : bc_num_slots.to_i %>"
- "--mem-per-cpu=<%= bc_num_mems.blank? ? 4 : bc_num_mems.to_i %>G"
- "--partition=<%= bc_partition %>"
- "--time=<%= bc_num_hours.blank? ? 1 : bc_num_hours.to_i %>:00:00"
- "--job-name=ood-vnc"
<%- if bc_partition.include? "pascalnodes" or bc_partition.include? "amperenodes" -%>
- "--gres=gpu:<%= bc_num_gpus.blank? ? 1 : bc_num_gpus.to_i %>"
<%- end -%>
<%- if bc_email_on_started == "1" -%>
- "--mail-type=BEGIN"
- "--mail-user=<%= email %>"
<%- end -%>
<%- if bc_email_on_started == "1" -%>
- "--mail-type=BEGIN"
- "--mail-user=<%= email %>"
<%- end -%>
<%- if bc_reservation != "" -%>
- "--reservation=<%= bc_reservation %>
<%- end -%>
batch_connect:
template: vnc
......@@ -13,33 +13,5 @@ if [[ -f "${HOME}/.config/monitors.xml" ]]; then
mv "${HOME}/.config/monitors.xml" "${HOME}/.config/monitors.xml.bak"
fi
# gnome won't start correctly without DBUS_SESSION_BUS_ADDRESS set.
eval $(dbus-launch --sh-syntax)
source /etc/os-release
function classic(){
export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:-x11}"
export GNOME_SHELL_SESSION_MODE="${GNOME_SHELL_SESSION_MODE:-classic}"
export GNOME_SESSION_MODE="${GNOME_SESSION_MODE:-classic}"
}
function wayland() {
export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:-x11}"
export GNOME_SHELL_SESSION_MODE="${GNOME_SHELL_SESSION_MODE:-wayland}"
export GNOME_SESSION_MODE="${GNOME_SESSION_MODE:-wayland}"
}
if [[ "$ID_LIKE" =~ "fedora" ]]; then
if [[ "$VERSION_ID" < "8.0" ]]; then
# el7 will crash using wayland.
classic
else
wayland
fi
else
wayland
fi
# Start up Gnome desktop (block until user logs out of desktop)
/etc/X11/xinit/Xsession gnome-session
startkde
\ No newline at end of file
......@@ -14,9 +14,7 @@ AUTOSTART="${HOME}/.config/autostart"
rm -fr "${AUTOSTART}" # clean up previous autostarts
mkdir -p "${AUTOSTART}"
for service in "gnome-keyring-gpg" "gnome-keyring-pkcs11" "gnome-keyring-secrets" "gnome-keyring-ssh" "mate-volume-control-applet" "polkit-mate-authentication-agent-1" "pulseaudio" "rhsm-icon" "spice-vdagent" "xfce4-power-manager"; do
if [[ -f "/etc/xdg/autostart/${service}.desktop" ]]; then
cat "/etc/xdg/autostart/${service}.desktop" <(echo "X-MATE-Autostart-enabled=false") > "${AUTOSTART}/${service}.desktop"
fi
cat "/etc/xdg/autostart/${service}.desktop" <(echo "X-MATE-Autostart-enabled=false") > "${AUTOSTART}/${service}.desktop"
done
# Disable pulseaudio
......
......@@ -36,9 +36,5 @@ else
"${TERM_CONFIG}"
fi
# launch dbus first through eval becuase it can conflict with a conda environment
# see https://github.com/OSC/ondemand/issues/700
eval $(dbus-launch --sh-syntax)
# Start up xfce desktop (block until user logs out of desktop)
xfce4-session
......@@ -9,12 +9,7 @@ module purge && module restore
# Ensure that the user's configured login shell is used
export SHELL="$(getent passwd $USER | cut -d: -f7)"
# use a safe PATH to boot the desktop because dbus-launch can be
# in another location from a python/conda installation and that will
# conflict and cause issues. See https://github.com/OSC/ondemand/issues/700 for more.
SAFE_PATH="/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin"
# Start up desktop
echo "Launching desktop '<%= context.desktop %>'..."
PATH="$SAFE_PATH" source "<%= session.staged_root.join("desktops", "#{context.desktop}.sh") %>"
echo "Desktop '<%= context.desktop %>' ended with $? status..."
source "<%= session.staged_root.join("desktops", "#{context.desktop}.sh") %>"
echo "Desktop '<%= context.desktop %>' ended..."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment