-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.js
More file actions
66 lines (58 loc) · 1.91 KB
/
form.js
File metadata and controls
66 lines (58 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Map partition names to their time limits in hours
const partitionMaxHours = {
"short": 30, // 1-06:00:00
"long": 240, // 10-00:00:00
"himem": 240,
"gpu_interactive": 12,
"gpu_p100_16gb": 60,
"gpu_v100_16gb": 60,
"gpu_v100_32gb": 60,
"gpu_a100_40gb": 60,
"gpu_a100_80gb": 60,
"gpu_rtx8000_48gb": 60,
"gpu_gh200_144gb": 60,
"relion": 240,
"fraser": 240,
"brcgel": 240,
"win": 240,
"cloudcomp": 240,
};
function updateMaxHours() {
const partition = $("#batch_connect_session_context_auto_queues").val();
const maxHours = partitionMaxHours[partition] || 240;
const hoursField = $("#batch_connect_session_context_bc_num_hours");
hoursField.attr("max", maxHours);
const currentVal = parseInt(hoursField.val(), 10);
if (currentVal > maxHours) {
hoursField.val(maxHours);
}
hoursField.closest(".form-group")
.find(".form-text")
.text(
`Maximum runtime in hours for your session. ` +
`The '${partition}' partition allows up to ${maxHours} hour(s).`
);
}
function updateGpuAccountField() {
const partition = $("#batch_connect_session_context_auto_queues").val();
const isGpu = partition.startsWith("gpu_");
const gpuAccountGroup = $("#batch_connect_session_context_gpu_account")
.closest(".form-group");
if (isGpu) {
gpuAccountGroup.show();
$("#batch_connect_session_context_gpu_account").attr("required", true);
} else {
gpuAccountGroup.hide();
$("#batch_connect_session_context_gpu_account")
.removeAttr("required")
.val("");
}
}
$(document).ready(function () {
updateMaxHours();
updateGpuAccountField();
$("#batch_connect_session_context_auto_queues").on("change", function () {
updateMaxHours();
updateGpuAccountField();
});
});