diff --git a/local/heb115.yml.erb b/local/heb115.yml.erb new file mode 100644 index 0000000..6848480 --- /dev/null +++ b/local/heb115.yml.erb @@ -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-`. 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 ` 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 diff --git a/manifest.yml b/manifest.yml index 92014e9..b33e459 100644 --- a/manifest.yml +++ b/manifest.yml @@ -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. diff --git a/spack-environment/heb115/spack.yml b/spack-environment/heb115/spack.yml new file mode 100644 index 0000000..e605df6 --- /dev/null +++ b/spack-environment/heb115/spack.yml @@ -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 \ No newline at end of file