From 1474dab116436a897770bda60e9ec68d2e92ecf1 Mon Sep 17 00:00:00 2001
From: "Gin Tan (Monash University)" <ctan@m3-mgmt1.massive.org.au>
Date: Mon, 10 Jul 2017 15:28:27 +1000
Subject: [PATCH] Dropping cache on epilog & prolog

---
 roles/slurm-common/templates/slurm.epilog.j2 | 7 +++++++
 roles/slurm-common/templates/slurm.prolog.j2 | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/roles/slurm-common/templates/slurm.epilog.j2 b/roles/slurm-common/templates/slurm.epilog.j2
index 9755cf92..71b02e52 100644
--- a/roles/slurm-common/templates/slurm.epilog.j2
+++ b/roles/slurm-common/templates/slurm.epilog.j2
@@ -1,6 +1,13 @@
 #!/bin/sh
+
 # specific files to be deleted to clean up after a Strudel session
 find /tmp -user ${SLURM_JOB_USER} -name "pulse*" | xargs rm -rf
 find /tmp -user ${SLURM_JOB_USER} -name ".esd-*" | xargs rm -rf
 find /tmp -user ${SLURM_JOB_USER} -name ".X*-lock" | xargs rm -rf
 find /tmp/.X11-unix -user ${SLURM_JOB_USER} -name "X*" | xargs rm -rf
+
+# files to be deleted from /tmp after jobs completed
+/bin/find /tmp -user ${SLURM_JOB_USER} -type 'f' -print0 | /usr/bin/xargs -0 -r /bin/rm -f
+
+# echo 1 to drop page cache
+sync; echo 1 > /proc/sys/vm/drop_caches
diff --git a/roles/slurm-common/templates/slurm.prolog.j2 b/roles/slurm-common/templates/slurm.prolog.j2
index 039e4d00..af563f85 100644
--- a/roles/slurm-common/templates/slurm.prolog.j2
+++ b/roles/slurm-common/templates/slurm.prolog.j2
@@ -1,2 +1,6 @@
 #!/bin/sh
+
+# echo 1 to drop page cache
+sync; echo 1 > /proc/sys/vm/drop_caches
+
 exit 0
-- 
GitLab