Open OnDemand Sandbox: Difference between revisions

From Cheaha
Jump to navigation Jump to search
(→‎Setting up sandbox for your profile: Fix variable name to $USER_DATA to match env.)
(→‎Building your first dev app: Clarify local git directory def)
Line 31: Line 31:
'''Note:''' You can also check the line, about creating a new git repo, if you want to use it to maintain your own instance of the app.
'''Note:''' You can also check the line, about creating a new git repo, if you want to use it to maintain your own instance of the app.


* Now click on '''Files''' to take a look at the files for the app (git repo), that you just cloned.
* Now click on '''Files''' to take a look at the files for the app (local git repo working directory), that you just cloned.


* Highlight '''form.yml''' and click on '''Edit''' . Change the file to the following content:
* Highlight '''form.yml''' and click on '''Edit''' . Change the file to the following content:

Revision as of 18:15, 7 August 2020

Open OnDemand is a web interface to Cheaha HPC resources. We have setup multiple general purpose apps, such as HPC Desktop, Jupyter, RStudio etc, on cheaha, to make the process of accessing these basic softwares easier. OnDemand also allows users to setup their own personal apps in the OnDemand, as sandbox apps.

Setting up sandbox for your profile

Setting up sandbox is pretty simple and straightforward.

  • You need to create a dev folder in your $USER_DATA/ondemand folder
mkdir -p $USER_DATA/ondemand/dev
  • Then go to Cheaha OnDemand , login, and under Help, click on Restart Web Server
  • You have successfully enabled sandbox for your environment, and you should see a new Develop tab.

Building your first dev app

Over here we provide instructions to create your first example dev script:

  • Under Develop tab , click on My SandBox Apps (Development)
  • Now click on New App tab
  • Now we are going to import an already existing git repo for an app, by clicking on Clone Existing App
  • Add the following values in the form:
Directory Name: IGV
Git Remote: https://github.com/uabrc/ood_igv.git

and Submit

Note: You can also check the line, about creating a new git repo, if you want to use it to maintain your own instance of the app.

  • Now click on Files to take a look at the files for the app (local git repo working directory), that you just cloned.
  • Highlight form.yml and click on Edit . Change the file to the following content:
---
cluster: "SLURM_CLUSTER"
attributes:
  bc_num_hours:
    value: 1

  bc_num_slots:
    label: Number of CPU
    value: 1
    min: 1
    max: 24
    step: 1

  bc_num_mems:
    widget: "number_field"
    label: Memory per CPU (GB)
    value: 4
    min: 1
    max: 128
    step: 1

  bc_partition:
    widget: select
    label: Partition
    options:
      - [ "express", "express" ]
      - [ "short", "short" ]
      - [ "medium", "medium" ]
      - [ "long", "long" ]
      - [ "interactive", "interactive" ]
      - [ "pascalnodes", "pascalnodes" ]

  version:
    widget: select
    label: "IGV version"
    help: "This defines the version of IGV you want to load."
    options:
      - [ "2.5.0-Java-11", "IGV/2.5.0-Java-11" ]

form:
  - version
  - bc_num_hours
  - bc_partition
  - bc_num_slots
  - bc_num_mems
  - bc_email_on_started

and save the file, and close the tab.

Here we are specifying what the form for the app is going to look like, and changing available parameters for Cheaha.

  • Now again in the file explorer for your app, click on New File with name submit.yml.erb
  • Edit the file submit.yml.erb, with the following content.
---
batch_connect:
  template: "vnc"
script:
  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-igv"
<%- if bc_partition == "pascalnodes" -%>
    - "--gres=gpu:1"
<%- end -%>

SAve the file, and close the tab

  • Now, go into template folder and create a new file script.sh.erb, and add following content to it:
#!/usr/bin/env bash


# Clean the environment
module reset

# Set working directory to home directory
cd "${HOME}"

#
# Launch Xfce Window Manager and Panel
#

(
  export SEND_256_COLORS_TO_REMOTE=1
  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
  set -x
  xfwm4 --compositor=off --daemon --sm-client-disable
  xsetroot -solid "#D3D3D3"
  xfsettingsd --sm-client-disable
  xfce4-panel --sm-client-disable
) &

#
# Start Integrative Genomics Viewer
#

# Load the required environment
module load <%= context.version %>
# Launch IGV
module list
set -x
igvtools_gui.command &
igv.sh

Save the file, and close the tab. Now click on Open in terminal, and run

chmod +x script.sh.erb

, and then close the terminal. This script needs to be an executable file.

This script runs the app executable after loading the appropriate module, based on the version you choose in the form.

  • Now close the file browser for your app.
  • Now click, on 'Launch IGV', and submit the job.

You should have your first dev app running.

More info

To get more example apps to build or to build passenger apps, look here.


Contact us if you run into any issues, or to discuss any new app.