Skip to content

Commit

Permalink
New classes for Spring 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
mcuma committed Feb 8, 2023
1 parent 895873f commit 8ec1eba
Show file tree
Hide file tree
Showing 50 changed files with 1,395 additions and 3 deletions.
75 changes: 75 additions & 0 deletions ASTR5560/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.2] - 2019-08-20
### Fixed
- Fixed bug where user's login shell was always set to Bash inside desktop sessions

## [0.2.1] - 2019-02-07
### Fixed
- Spelling

## [0.2.0] - 2018-03-26
### Added
- Added support for the Xfce desktop.

### Changed
- Moved "Account" field higher up in the form.
- Updated date in `LICENSE.txt`.

### Fixed
- Disabled all the unnecessary services that are auto-started when Mate loads.
- Fixed local configuration directory not always being ignored.
- Set Mate and Xfce terminals to launch login shell to get proper `TERM` set.
- Restore module environment in login shells.

### Removed
- Remove local OSC configuration as this has moved to
[osc-ood-config](https://github.com/OSC/osc-ood-config).

## [0.1.2] - 2017-10-12
### Changed
- Modified app to take advantage of ERB templates in updated Dashboard.
[#3](https://github.com/OSC/bc_desktop/issues/3)

## [0.1.1] - 2017-07-12
### Changed
- Changed the `CHANGELOG.md` formatting.
- Fixed form attributes `node_type` to `null` and `desktop` to `"mate"` for
default installs.

## [0.1.0] - 2017-06-14
### Changed
- Refactored for the new Batch Connect app.

### Fixed
- Disable disk check utility on startup.
[#2](https://github.com/OSC/bc_desktop/issues/2)

## [0.0.3] - 2017-01-18
### Fixed
- Set desktop working dir to user's home dir.

## [0.0.2] - 2017-01-04
### Added
- Added Mate desktop support.
- Added variable `$DESKTOP` that specifies desktop script run.

## 0.0.1 (2016-12-14)
### Added
- Initial release!

[Unreleased]: https://github.com/OSC/bc_desktop/compare/v0.2.2...HEAD
[0.2.2]: https://github.com/OSC/bc_desktop/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/OSC/bc_desktop/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/OSC/bc_desktop/compare/v0.1.2...v0.2.0
[0.1.2]: https://github.com/OSC/bc_desktop/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/OSC/bc_desktop/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/OSC/bc_desktop/compare/v0.0.3...v0.1.0
[0.0.3]: https://github.com/OSC/bc_desktop/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/OSC/bc_desktop/compare/v0.0.1...v0.0.2
22 changes: 22 additions & 0 deletions ASTR5560/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2016-2018 Ohio Supercomputer Center

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
77 changes: 77 additions & 0 deletions ASTR5560/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Batch Connect - Desktop

![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
41 changes: 41 additions & 0 deletions ASTR5560/form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: "ASTR5560"
attributes:
# desktop: "mate"
desktop: "xfce"
bc_vnc_idle: 0
bc_vnc_resolution:
required: true
cluster:
widget: "select"
options:
- "notchpeak"
bc_num_hours:
value: 2
min: 1
max: 8
step: 1
help: "Maximum wall time on notchpeak-shared-short is 8 hours."
my_account:
label: "Account"
widget: "select"
options:
- "notchpeak-shared-short"
my_queue:
label: "Partition"
widget: "select"
options:
- "notchpeak-shared-short"
bc_email_on_started:
help: "If you do not receive the email, check your [Profile](https://www.chpc.utah.edu/role/user/edit_profile.php) for correct address."

form:
- cluster
- bc_vnc_idle
- desktop
- bc_num_hours
- my_account
- my_queue
- bc_vnc_resolution
- bc_email_on_started

18 changes: 18 additions & 0 deletions ASTR5560/form.yml.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
attributes:
desktop: "mate"
bc_vnc_idle: 0
bc_vnc_resolution:
required: true
node_type: null

form:
- bc_vnc_idle
- desktop
- bc_account
- bc_num_hours
- bc_num_slots
- node_type
- bc_queue
- bc_vnc_resolution
- bc_email_on_started
10 changes: 10 additions & 0 deletions ASTR5560/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: ASTR5560
icon: fa://desktop
category: Classes
subcategory: Physics and Astronomy
role: batch_connect
description: |
This app will launch an interactive desktop on one compute node. You
will have full access to the resources these nodes provide. This is analogous
to an interactive batch job.
22 changes: 22 additions & 0 deletions ASTR5560/submit.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<%-
emailcmd = '/uufs/chpc.utah.edu/sys/bin/CHPCEmailLookup.sh ' + ENV["USER"]
emailaddr = %x[ #{emailcmd}]
-%>

---
batch_connect:
template: vnc
script:
email: <%= emailaddr %>
<%- if /frisco/.match(cluster) == nil -%>
native:
- "-N"
- "1"
- "-n"
- 4
- "-A"
- "<%= my_account %>"
- "-p"
- "<%= my_queue %>"
<%- end -%>

2 changes: 2 additions & 0 deletions ASTR5560/template/before.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Export the module function if it exists
[[ $(type -t module) == "function" ]] && export -f module
17 changes: 17 additions & 0 deletions ASTR5560/template/desktops/gnome.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Turn off screensaver
gconftool-2 --set -t boolean /apps/gnome-screensaver/idle_activation_enabled false

# Use browser window instead in nautilus
gconftool-2 --set -t boolean /apps/nautilus/preferences/always_use_browser true

# Disable the disk check utility on autostart
mkdir -p "${HOME}/.config/autostart"
cat "/etc/xdg/autostart/gdu-notification-daemon.desktop" <(echo "X-GNOME-Autostart-enabled=false") > "${HOME}/.config/autostart/gdu-notification-daemon.desktop"

# Remove any preconfigured monitors
if [[ -f "${HOME}/.config/monitors.xml" ]]; then
mv "${HOME}/.config/monitors.xml" "${HOME}/.config/monitors.xml.bak"
fi

# Start up Gnome desktop (block until user logs out of desktop)
/etc/X11/xinit/Xsession gnome-session
1 change: 1 addition & 0 deletions ASTR5560/template/desktops/kde.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
startkde
30 changes: 30 additions & 0 deletions ASTR5560/template/desktops/mate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Turn off screensaver (this may not exist at all)
gsettings set org.mate.screensaver idle-activation-enabled false

# Disable gnome-keyring-daemon
gsettings set org.mate.session gnome-compat-startup "['smproxy']"

# Remove any preconfigured monitors
if [[ -f "${HOME}/.config/monitors.xml" ]]; then
mv "${HOME}/.config/monitors.xml" "${HOME}/.config/monitors.xml.bak"
fi

# Disable useless services on autostart
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
cat "/etc/xdg/autostart/${service}.desktop" <(echo "X-MATE-Autostart-enabled=false") > "${AUTOSTART}/${service}.desktop"
done

# Disable pulseaudio
# Warning: If you disable pulseaudio you get flooded with warning messages
#PULSE_CONFIG="${HOME}/.config/pulse/client.conf"
#mkdir -p "$(dirname "${PULSE_CONFIG}")"
#echo "autospawn = no" > "${PULSE_CONFIG}"

# Run Mate Terminal as login shell (sets proper TERM)
dconf write /org/mate/terminal/profiles/default/login-shell true

# Start up mate desktop (block until user logs out of desktop)
mate-session
43 changes: 43 additions & 0 deletions ASTR5560/template/desktops/xfce.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Remove any preconfigured monitors
if [[ -f "${HOME}/.config/monitors.xml" ]]; then
mv "${HOME}/.config/monitors.xml" "${HOME}/.config/monitors.xml.bak"
fi

# Copy over default panel if doesn't exist, otherwise it will prompt the user
PANEL_CONFIG="${HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml"
if [[ ! -e "${PANEL_CONFIG}" ]]; then
mkdir -p "$(dirname "${PANEL_CONFIG}")"
cp "/etc/xdg/xfce4/panel/default.xml" "${PANEL_CONFIG}"
fi

# Disable startup services
xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false

# Disable useless services on autostart
AUTOSTART="${HOME}/.config/autostart"
rm -fr "${AUTOSTART}" # clean up previous autostarts
mkdir -p "${AUTOSTART}"
for service in "pulseaudio" "rhsm-icon" "spice-vdagent" "tracker-extract" "tracker-miner-apps" "tracker-miner-user-guides" "xfce4-power-manager" "xfce-polkit"; do
echo -e "[Desktop Entry]\nHidden=true" > "${AUTOSTART}/${service}.desktop"
done

# this causes Terminal to automatically start in the desktop
cp /usr/share/applications/xfce4-terminal.desktop "${AUTOSTART}"

# Run Xfce4 Terminal as login shell (sets proper TERM)
TERM_CONFIG="${HOME}/.config/xfce4/terminal/terminalrc"
if [[ ! -e "${TERM_CONFIG}" ]]; then
mkdir -p "$(dirname "${TERM_CONFIG}")"
sed 's/^ \{4\}//' > "${TERM_CONFIG}" << EOL
[Configuration]
CommandLoginShell=TRUE
EOL
else
sed -i \
'/^CommandLoginShell=/{h;s/=.*/=TRUE/};${x;/^$/{s//CommandLoginShell=TRUE/;H};x}' \
"${TERM_CONFIG}"
fi

# Start up xfce desktop (block until user logs out of desktop)
xfce4-session
21 changes: 21 additions & 0 deletions ASTR5560/template/script.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Change working directory to user's home directory
cd "${HOME}"

# Reset module environment (may require login shell for some HPC clusters)
module purge

module load mesa/r15140 python/3.6.8
export PYTHONPATH=/uufs/chpc.utah.edu/sys/installdir/mesa/py_mesa_reader:$PYTHONPATH


# Ensure that the user's configured login shell is used
export SHELL="$(getent passwd $USER | cut -d: -f7)"

hostname

# Start up desktop
echo "Launching desktop '<%= context.desktop %>'..."
source "<%= session.staged_root.join("desktops", "#{context.desktop}.sh") %>"
echo "Desktop '<%= context.desktop %>' ended..."
Loading

0 comments on commit 8ec1eba

Please sign in to comment.