Skip to content

Commit

Permalink
add support for the cardinal cluster (#33)
Browse files Browse the repository at this point in the history
add support for the cardinal cluster, while also making a few other updates.

* use auto_accounts.
* notebook not available for > 4.0, so be sure to force lab when at this version.
* corrects this environment variable for cardinal.
  • Loading branch information
johrstrom authored Dec 26, 2024
1 parent e3d6212 commit 815d966
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 18 deletions.
31 changes: 18 additions & 13 deletions form.yml.erb → form.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<%-
groups = OodSupport::User.new.groups.sort_by(&:id).tap { |groups|
groups.unshift(groups.delete(OodSupport::Process.group))
}.map(&:name).grep(/^P./)
-%>
---
cluster:
- "owens"
- "pitzer"
- "cardinal"
form:
- account
- auto_accounts
- jupyterlab_switch
- spark_version
- bc_num_hours
Expand All @@ -21,13 +17,6 @@ form:
- bc_email_on_started
- version
attributes:
account:
label: "Project"
widget: select
options:
<%- groups.each do |group| %>
- "<%= group %>"
<%- end %>
num_workers:
widget: "number_field"
value: "1"
Expand All @@ -53,11 +42,13 @@ attributes:
"any", "any",
data-max-num-workers-for-cluster-owens: 28,
data-max-num-workers-for-cluster-pitzer: 48,
data-max-num-workers-for-cluster-cardinal: 48,
]
- [
"hugemem", "hugemem",
data-max-num-workers-for-cluster-owens: 48,
data-max-num-workers-for-cluster-pitzer: 80,
data-option-for-cluster-cardinal: false,
]
spark_configuration_file:
help: Override defaults with a new configuration file. Leave blank to use defaults.
Expand All @@ -78,15 +69,23 @@ attributes:
spark_version:
widget: "select"
options:
- [
"3.5.1", "3.5.1",
data-option-for-cluster-owens: false,
data-option-for-cluster-pitzer: false,
]
- [
"3.4.1", "3.4.1",
data-option-for-cluster-cardinal: false,
]
- [
"3.0.1", "3.0.1",
data-option-for-cluster-cardinal: false,
]
- [
"2.4.5", "2.4.5",
data-option-for-cluster-owens: false,
data-option-for-cluster-cardinal: false,
]
- [
"2.3.0", "2.3.0",
Expand All @@ -96,12 +95,18 @@ attributes:
widget: "select"
label: "JupyterLab Version"
options:
- [
"4.1", "app_jupyter/4.1.5",
]
- [
"3.0", "app_jupyter/3.0.17",
data-option-for-cluster-cardinal: false,
]
- [
"2.2", "app_jupyter/2.2.10",
data-option-for-cluster-cardinal: false,
]
- [
"1.2", "app_jupyter/1.2.21",
data-option-for-cluster-cardinal: false,
]
7 changes: 4 additions & 3 deletions submit.yml.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<%-

cores_lookup = {"hugemem" => {"pitzer" => "80", "owens" => "48"},
"any" => {"pitzer" => "40", "owens" => "28"}}
cores_lookup = {
"hugemem" => {"pitzer" => "80", "owens" => "48"},
"any" => {"pitzer" => "40", "owens" => "28", "cardinal" => "48"}
}

base_slurm_args = if bc_num_slots.blank?
["--nodes", "1", "--exclusive", "--ntasks-per-node", cores_lookup[node_type][cluster] ]
Expand All @@ -28,7 +30,6 @@ batch_connect:
- "spark_ui_auth_token"
- "spark_version"
script:
accounting_id: "<%= account %>"
native:
<%- slurm_args.each do |arg| %>
- "<%= arg %>"
Expand Down
8 changes: 7 additions & 1 deletion template/before.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,16 @@ module purge
# Load the runtime environment
runtime_env() {
module purge
module load xalt/latest python/3.6-conda5.2 spark/<%= context.spark_version %>
module load xalt/latest
<%- if context.cluster != 'cardinal' -%>
module load python/3.6-conda5.2 spark/<%= context.spark_version %>
<%- else -%>
module load python/3.12 spark/<%= context.spark_version %>
<%- end -%>

# Disable randomized hash for string in Python 3.3+
export PYTHONHASHSEED=0
export SPARK_PY4J_PATH=$(eval echo "$SPARK_HOME/python/lib/py4j-*.zip")
}

#
Expand Down
14 changes: 13 additions & 1 deletion template/script.sh.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env bash

<%-
subcommand = if context.version.split('/')[1].to_s > '4.0' || context.jupyterlab_switch == "1"
'lab'
else
'notebook'
end
-%>

#
# Start Jupyter Notebook server + Spark cluster
#
Expand Down Expand Up @@ -34,7 +42,11 @@ cd "${NOTEBOOK_ROOT}"
echo "TTT - $(date)"

# Setup Jupyter Notebook environment
<%- if context.cluster == 'cardinal' -%>
module load project/ondemand xalt/latest <%= context.version %>
<%- else -%>
module load ondemand/project xalt/latest <%= context.version %>
<%- end -%>
module list

echo "TTT - $(date)"
Expand All @@ -48,4 +60,4 @@ echo "TTT - $(date)"

# Launch Jupyter Notebook interface to Spark
set -x
jupyter <%= context.jupyterlab_switch == "1" ? "lab" : "notebook" %> --config="${CONFIG_FILE}"
jupyter <%= subcommand %> --config="${CONFIG_FILE}"

0 comments on commit 815d966

Please sign in to comment.