From d4bc40a5284981397b85c5852d7aca5cab5be5cb Mon Sep 17 00:00:00 2001
From: Krish Moodbidri <krish94@uab.edu>
Date: Wed, 15 May 2019 11:39:42 -0500
Subject: [PATCH] Modified to suit SAS environmentwq

---
 form.yml               | 78 +++++++++++++++++-------------------------
 manifest.yml           | 10 +++---
 submit.yml.erb         | 14 ++++----
 template/script.sh.erb | 19 +++-------
 4 files changed, 46 insertions(+), 75 deletions(-)

diff --git a/form.yml b/form.yml
index 3781047..a2e2fe5 100644
--- a/form.yml
+++ b/form.yml
@@ -1,56 +1,40 @@
 ---
-cluster: "owens"
-form:
-  - version
-  - bc_account
-  - bc_num_hours
-  - bc_num_slots
-  - num_cores
-  - node_type
-  - bc_vnc_resolution
-  - bc_email_on_started
+cluster: "{{ cluster_name }}"
 attributes:
-  num_cores:
-    widget: "number_field"
-    label: "Number of cores"
+  bc_num_hours:
+    value: 1
+
+  bc_num_slots:
+    label: Number of CPU
     value: 1
-    help: |
-      Number of cores on node type (4 GB per core unless requesting whole
-      node). Leave blank if requesting full node.
-    min: 0
-    max: 48
+    min: 1
+    max: 24
     step: 1
-    id: 'num_cores'
-  bc_num_slots: "1"
-  bc_vnc_resolution:
-    required: true
-  bc_account:
-    label: "Project"
-    help: "You can leave this blank if **not** in multiple projects."
-  node_type:
+
+  bc_num_mems:
+    widget: "number_field"
+    label: Memory per CPU (GB)
+    value: 4
+    min: 1
+    max: 128
+    step: 1
+
+  bc_partition:
     widget: select
-    label: "Node type"
-    help: |
-      - **any** - (*1-28 cores*) Use any available Owens node. This reduces the
-        wait time as there are no node requirements.
-      - **hugemem** - (*48 cores*) Use an Owens node that has 1.5TB of
-        available RAM as well as 48 cores. There are 16 of these nodes on
-        Owens. Requesting hugemem nodes allocates entire nodes.
-      - **vis** - (*1-28 cores*) Use an Owens node that has an [NVIDIA Tesla P100
-        GPU](http://www.nvidia.com/object/tesla-p100.html) with an X server
-        running in the background. This utilizes the GPU for hardware
-        accelerated 3D visualization. There are 160 of these nodes on Owens.
+    label: Partition
     options:
-      - [ "any",     ""            ]
-      - [ "hugemem", ":hugemem"    ]
-      - [ "vis",     ":vis:gpus=1" ]
+      - [ "low", "low" ]
+
   version:
     widget: select
-    label: "MATLAB version"
-    help: "This defines the version of MATLAB you want to load."
+    label: "SAS version"
+    help: "This defines the version of SAS you want to load."
     options:
-      - [ "R2018b", "matlab/r2018b" ]
-      - [ "R2018a", "matlab/r2018a" ]
-      - [ "R2017a", "matlab/r2017a" ]
-      - [ "R2016b", "matlab/r2016b" ]
-      - [ "R2015b", "matlab/r2015b" ]
+      - [ "v9.4", "sas/v9.4" ]
+form:
+  - version
+  - bc_num_hours
+  - bc_partition
+  - bc_num_slots
+  - bc_num_mems
+  - bc_email_on_started
diff --git a/manifest.yml b/manifest.yml
index 0841d1e..cd4010d 100644
--- a/manifest.yml
+++ b/manifest.yml
@@ -1,11 +1,11 @@
 ---
-name: MATLAB
+name: SAS
 category: Interactive Apps
 subcategory: GUIs
 role: batch_connect
 description: |
-  This app will launch a [MATLAB] GUI on the [Owens cluster]. You will be able
-  to interact with the MATLAB GUI through a VNC session.
+  This app will launch a [SAS] GUI on the [Cheaha cluster]. You will be able
+  to interact with the SAS GUI through a VNC session.
 
-  [MATLAB]: https://www.mathworks.com/products/matlab.html
-  [Owens cluster]: https://www.osc.edu/resources/technical_support/supercomputers/owens
+  [SAS]: https://www.sas.com/en_us/home.html 
+  [Cheaha cluster]: https://docs.uabgrid.uab.edu/wiki/Cheaha_GettingStarted
diff --git a/submit.yml.erb b/submit.yml.erb
index 1ced835..8b17d32 100644
--- a/submit.yml.erb
+++ b/submit.yml.erb
@@ -1,13 +1,11 @@
-<%-
-ppn = num_cores.blank? ? 28 : num_cores.to_i
-if node_type == ':hugemem'
-  ppn = 48
-end
-%>
 ---
 batch_connect:
   template: vnc
 script:
   native:
-    resources:
-      nodes: "<%= bc_num_slots.blank? ? "1" : bc_num_slots.to_i %>:ppn=<%= ppn %><%= node_type %>"
+    - "-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"
+
diff --git a/template/script.sh.erb b/template/script.sh.erb
index 3f4d585..43ecbe5 100755
--- a/template/script.sh.erb
+++ b/template/script.sh.erb
@@ -1,6 +1,5 @@
 #!/usr/bin/env bash
 
-<%- gpu = context.node_type.include?("vis") -%>
 
 # Clean the environment
 module purge
@@ -26,20 +25,10 @@ cd "${HOME}"
 ) &
 
 #
-# Start MATLAB
+# Start SAS
 #
 
 # Load the required environment
-module load <%= context.version %>
-
-# Launch MATLAB
-<%- if gpu -%>
-module load intel/16.0.3 virtualgl
-module list
-set -x
-vglrun matlab -desktop -nosoftwareopengl
-<%- else -%>
-module list
-set -x
-matlab -desktop
-<%- end -%>
+module load sas
+# Launch SAS
+sas
-- 
GitLab