From 3fbb0908681d2000216d9661f55bd6a223064dde Mon Sep 17 00:00:00 2001
From: Matthew K Defenderfer <mdefende@uab.edu>
Date: Tue, 3 Jun 2025 10:57:02 -0500
Subject: [PATCH] fixed the basic stuff to get an app to actually start

---
 form.yml.erb   |  7 +------
 submit.yml.erb | 30 +++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/form.yml.erb b/form.yml.erb
index 0743d97..427dd3b 100644
--- a/form.yml.erb
+++ b/form.yml.erb
@@ -4,6 +4,7 @@
 ---
 title: "HPC Desktop"
 cluster: SLURM_CLUSTER
+submit: "submit.yml.erb"
 attributes:
   desktop: "xfce"
   bc_num_slots:
@@ -37,16 +38,10 @@ attributes:
       - [ "<%= p %>", "<%= p %>" ]
     <%- end -%>
 
-  bc_reservation:
-    widget: "text_field"
-    label: Reservation Name
-    value: ""
-
 form:
   - desktop
   - bc_num_hours
   - bc_partition
-  - bc_reservation
   - bc_num_gpus
   - bc_num_slots
   - bc_num_mems
diff --git a/submit.yml.erb b/submit.yml.erb
index c479578..516b352 100644
--- a/submit.yml.erb
+++ b/submit.yml.erb
@@ -1,3 +1,31 @@
+<%-
+  email = ENV['USER']
+  if !email.include? '@'
+    email = email + '@uab.edu'
+  end
+-%>
 ---
 batch_connect:
-  template: vnc
+  template: "vnc"
+
+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-vnc"
+<%- 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 -%>
+<%- if bc_email_on_started == "1" -%>
+    - "--mail-type=BEGIN"
+    - "--mail-user=<%= email %>"
+<%- end -%>
-- 
GitLab