Skip to content

Commit

Permalink
Merge pull request #3 from Harvard-ATG/heb115
Browse files Browse the repository at this point in the history
Add customizations for use in HEB 115
  • Loading branch information
jaguillette authored Sep 23, 2024
2 parents 56a2157 + da97201 commit d0b28d5
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 2 deletions.
84 changes: 84 additions & 0 deletions local/heb115.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Batch Connect app configuration file
#
# @note Used to define the submitted cluster, title, description, and
# hard-coded/user-defined attributes that make up this Batch Connect app.
<%-
# User POSIX groups are checked against a list of Canvas Course IDs, which are
# expected to be present in group names following the convention
# `canvas<canvas_id>-<group_id>`. To add to this list, add a Canvas Course ID
# and comment it with the title of the course.
userGroups = OodSupport::User.new.groups.sort_by(&:id).map(&:name).flat_map{ |str| str.scan(/^canvas(\d+)-\d+/) }.flatten
enabledGroups = [
"135510", # HUIT Open OnDemand Testing
"139860" # HEB 115: Investigating the Human Genome
]

def arrays_have_common_element(array1, array2)
# Use the `&` operator to get the intersection of the two arrays
# If the intersection is not empty, return true, otherwise false
!(array1 & array2).empty?
end

# Check if the groups that the user is in match any of the courses that should
# have access to this app.

if arrays_have_common_element(userGroups, enabledGroups)
cluster="*"
else
cluster="disable_this_app"
end
-%>
---

# Set cluster from group. "*" runs on whatever cluster is available, and
# "disable_this_app" hides the app from view.
cluster: "<%= cluster %>"

title: "Jupyter Lab - HEB 115"

# Define attribute values that aren't meant to be modified by the user within
# the Dashboard form
attributes:
# Set the corresponding modules that need to be loaded for Jupyter to run
#
# @note It is called within the batch job as `module load <modules>` if
# defined
# @example Do not load any modules
# modules: ""
# @example Using default python module
# modules: "python"
# @example Using specific python module
# modules: "python/3.5"
# @example Using combination of modules
# modules: "python/3.5 cuda/8.0.44"
environment: heb115

spack: "/shared/spack"

custom_num_cores:
widget: "number_field"
label: "Number of CPUs"
value: 1
min: 1
max: 4
step: 1

# Any extra command line arguments to feed to the `jupyter notebook ...`
# command that launches the Jupyter notebook within the batch job
extra_jupyter_args: ""

# All of the attributes that make up the Dashboard form (in respective order),
# and made available to the submit configuration file and the template ERB
# files
#
# @note You typically do not need to modify this unless you want to add a new
# configurable value
# @note If an attribute listed below is hard-coded above in the `attributes`
# option, then it will not appear in the form page that the user sees in the
# Dashboard
form:
- environment
- spack
- extra_jupyter_args
- bc_num_hours
- custom_num_cores
9 changes: 7 additions & 2 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
name: Jupyter Notebook (spack)
name: Jupyter Lab
category: Interactive Apps
subcategory: Servers
role: batch_connect
description: |
This app will launch a Jupyter Notebook server on one or more nodes. This configuration uses spack to load Jupyter Lab.
This app will launch a Jupyter Lab server. This configuration uses
[Spack](https://spack.io/) to load Jupyter Lab. The app launches outside of a
container, so it has access to slurm commands, but since the app is running as
a slurm job, the `srun` command will use the resources of the current job,
rather than starting a new job. That is, unless you first run an `salloc`
command to allocate a new interactive session first.
19 changes: 19 additions & 0 deletions spack-environment/heb115/spack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
# add package specs to the `specs` list
specs:
- admixtools
- bcftools
- plink
- samtools
- py-jupyterlab
- py-numpy
- py-pandas
- py-matplotlib
- py-scipy
view: true
concretizer:
unify: true

0 comments on commit d0b28d5

Please sign in to comment.