Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rc/bc_uab_jupyterlab
  • louistw/bc_uab_jupyterlab
  • rc-data-science/community-ood-sandbox/bc_uab_jupyterlab_singularity
3 results
Show changes
Commits on Source (28)
const table = {
"interactive": { "max_cpu": 48, "max_hour": 2, "max_gpu": 0 },
"express": { "max_cpu": 48, "max_hour": 2, "max_gpu": 0 },
"short": { "max_cpu": 48, "max_hour": 12, "max_gpu": 0 },
"pascalnodes": { "max_cpu": 28, "max_hour": 12, "max_gpu": 4 },
"pascalnodes-medium": { "max_cpu": 28, "max_hour": 48, "max_gpu": 4 },
"medium": { "max_cpu": 48, "max_hour": 50, "max_gpu": 0 },
"long": { "max_cpu": 48, "max_hour": 150, "max_gpu": 0 },
"intel-dcb": { "max_cpu": 24, "max_hour": 150, "max_gpu": 0 },
"amd-hdr100": { "max_cpu": 128, "max_hour": 150, "max_gpu": 0 },
"largemem": { "max_cpu": 24, "max_hour": 50, "max_gpu": 0 },
"largemem-long": { "max_cpu": 24, "max_hour": 150, "max_gpu": 0 },
"amperenodes": { "max_cpu": 128, "max_hour": 12, "max_gpu": 2 },
"amperenodes-medium": { "max_cpu": 128, "max_hour": 48, "max_gpu": 2 },
}
const gpu_part_regex = /pascal|ampere/;
function set_max_value(form_id, value) {
const form_element = $(form_id);
form_element.attr({'max': value});
if (form_element.val() > value)
form_element.val(value)
}
function set_partition_change_handler() {
let partition_select = $("#batch_connect_session_context_bc_partition");
partition_select.change( function(e) {
toggle_gpu_visibility(e);
});
}
function toggle_gpu_visibility(event) {
const partition = event.target.value;
const cpu_selector = '#batch_connect_session_context_bc_num_slots';
const gpu_selector = '#batch_connect_session_context_bc_num_gpus';
const hour_selector = '#batch_connect_session_context_bc_num_hours';
toggle_visibilty_of_form_group(gpu_selector, gpu_part_regex.test(partition));
set_max_value(cpu_selector, table[partition]["max_cpu"]);
set_max_value(gpu_selector, table[partition]["max_gpu"]);
set_max_value(hour_selector, table[partition]["max_hour"]);
}
function toggle_visibilty_of_form_group(form_id, show) {
let form_element = $(form_id);
let parent = form_element;
while (
(! parent[0].classList.contains('form-group')) &&
(! parent.is('html')) // ensure that we don't loop infinitely
) {
parent = parent.parent();
}
// If parent is HTML then something has gone wrong and visibility should not be changed
if ( parent.is('html') ) {
return;
}
if(show) {
parent.show();
} else {
parent.hide();
}
}
toggle_gpu_visibility(
// Fake the event
{ target: document.querySelector('#batch_connect_session_context_bc_partition') }
);
set_partition_change_handler();
<%-
partitions = OodAppkit.clusters[:SLURM_CLUSTER].custom_config[:partitions]
-%>
# Batch Connect app configuration file
#
# @note Used to define the submitted cluster, title, description, and
......@@ -66,6 +69,7 @@ attributes:
value: 1
bc_num_slots:
widget: "number_field"
label: Number of CPU
value: 1
min: 1
......@@ -80,20 +84,21 @@ attributes:
max: 128
step: 1
bc_num_gpus:
widget: "number_field"
label: Number of GPUs
value: 1
min: 0
max: 4
step: 1
bc_partition:
widget: select
label: Partition
options:
- [ "express", "express" ]
- [ "short", "short" ]
- [ "medium", "medium" ]
- [ "long", "long" ]
- [ "interactive", "interactive" ]
- [ "pascalnodes", "pascalnodes" ]
- [ "pascalnodes-medium", "pascalnodes-medium" ]
- [ "largemem", "largemem" ]
- [ "largemem-long", "largemem-long" ]
- [ "amd-hdr100", "amd-hdr100" ]
<%- partitions.each do |p| -%>
- [ "<%= p %>", "<%= p %>" ]
<%- end -%>
# 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
......@@ -110,6 +115,7 @@ form:
- extra_jupyter_args
- bc_num_hours
- bc_partition
- bc_num_gpus
- bc_num_slots
- bc_num_mems
- bc_email_on_started
# Job submission configuration file
#
<%-
email = ENV['USER']
if !email.include? '@'
email = email + '@uab.edu'
end
-%>
---
# This config comes from below URL
# https://github.com/OSC/bc_example_jupyter/blob/custom_environment/submit.yml.erb
# The -C option in the config provided for slurm has been removed because it does
# not apply to implementation at UAB. We do not use constraint list to be used with -C.
# The -C option in the config provided for slurm has been removed because it does
# not apply to implementation at UAB. We do not use constraint list to be used with -C.
batch_connect:
template: "basic"
script:
job_environment:
USER: "<%= ENV['USER'] %>"
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-jupyter"
<%- if bc_partition.include? "pascalnodes" -%>
- "--gres=gpu:1"
- "--job-name=ood-jupyterlab"
<%- if bc_partition.include? "pascalnodes" or bc_partition.include? "amperenodes" -%>
- "--gres=gpu:<%= bc_num_gpus.blank? ? 1 : bc_num_gpus.to_i %>"
<%- end -%>
<%- if bc_email_on_started == "1" -%>
- "--mail-type=BEGIN"
- "--mail-user=<%= email %>"
<%- end -%>
# Wait for the Jupyter Notebook server to start
echo "Waiting for Jupyter Notebook server to open port ${port}..."
# Wait for the Jupyterlab server to start
echo "Waiting for Jupyterlab server to open port ${port}..."
echo "TIMING - Starting wait at: $(date)"
if wait_until_port_used "${host}:${port}" 60; then
echo "Discovered Jupyter Notebook server listening on port ${port}!"
if wait_until_port_used "${host}:${port}" 600; then
echo "Discovered Jupyterlab server listening on port ${port}!"
echo "TIMING - Wait ended at: $(date)"
else
echo "Timed out waiting for Jupyter Notebook server to open port ${port}!"
echo "Timed out waiting for Jupyterlab server to open port ${port}!"
echo "TIMING - Wait ended at: $(date)"
pkill -P ${SCRIPT_PID}
clean_up 1
......
......@@ -7,7 +7,7 @@ module reset
# Start JupyterLab Server
#
module load Anaconda3
<%= context.custom_environment %>
<%= context.custom_environment.gsub(/\r\n?/, "\n") %>
unset XDG_RUNTIME_DIR
# Launch the JupyterLab Server
jupyter-lab --config="${CONFIG_FILE}" <%= context.extra_jupyter_args %>