From f0a6e9ef0ac6ab9e94aebea83e6ab78f0afd1214 Mon Sep 17 00:00:00 2001
From: Damien Leong <damien@192-168-1-13.tpgi.com.au>
Date: Fri, 19 Oct 2018 01:09:27 +1100
Subject: [PATCH] Changes to job_filter on handling m3c,m3h,m3g submission
 without gres

---
 .../slurm-common/templates/job_submit.lua.j2  | 23 +++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/roles/slurm-common/templates/job_submit.lua.j2 b/roles/slurm-common/templates/job_submit.lua.j2
index 1d3da371..b853250e 100644
--- a/roles/slurm-common/templates/job_submit.lua.j2
+++ b/roles/slurm-common/templates/job_submit.lua.j2
@@ -15,13 +15,32 @@
 
 function slurm_job_submit(job_desc, part_list, submit_uid)
 
+
+-- Check no default account
+
 if job_desc.account == "default" then
-slurm.log_user("You have to specify your project ID as part of your job submission. The account=default is now deprecated on M3 job scheduler.")
-return slurm.ERROR
+   slurm.log_user("You have to specify your project ID as part of your job submission. The account=default is now deprecated on M3 job scheduler.")
+   return slurm.ERROR
 end
 
+
+
+-- Check for gres.gpu requirements in m3c, m3h and m3g, else move job to comp
+
+if ((job_desc.partition == "m3c" ) or (job_desc.partition == "m3h" ) or (job_desc.partition == "m3g" ))  then
+   local partition = ""
+   if (job_desc.gres == nil) then
+      partition = "comp"
+      slurm.log_info("slurm_job_submit: for user: %u, partition: %s", submit_uid, partition)
+      job_desc.partition = partition
+   end
+   return slurm.SUCCESS
 end
 
+end
+
+
+
 function slurm_job_modify(job_desc, job_rec, part_list, modify_uid)
        return slurm.SUCCESS
 end
-- 
GitLab