From 523d193e428e9eab4ef695b84065ba34884b4a0c Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Thu, 14 Apr 2016 15:38:33 -0400
Subject: [PATCH] Don't set stage_out email for a Cray Burst Buffer if not set.

Otherwise --mail-type=ALL will send an unexpected stage_out message back
to the user.

Bug 2541.
---
 src/plugins/burst_buffer/cray/burst_buffer_cray.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/plugins/burst_buffer/cray/burst_buffer_cray.c b/src/plugins/burst_buffer/cray/burst_buffer_cray.c
index bcc22cd3074..dc2583fccd6 100644
--- a/src/plugins/burst_buffer/cray/burst_buffer_cray.c
+++ b/src/plugins/burst_buffer/cray/burst_buffer_cray.c
@@ -2280,7 +2280,7 @@ static int _parse_bb_opts(struct job_descriptor *job_desc, uint64_t *bb_size,
 	char *end_ptr = NULL, *sub_tok, *tok;
 	uint64_t tmp_cnt;
 	int rc = SLURM_SUCCESS, swap_cnt = 0;
-	bool enable_persist = false, have_bb = false;
+	bool enable_persist = false, have_bb = false, have_stage_out = false;
 
 	xassert(bb_size);
 	*bb_size = 0;
@@ -2413,6 +2413,8 @@ static int _parse_bb_opts(struct job_descriptor *job_desc, uint64_t *bb_size,
 					rc =ESLURM_INVALID_BURST_BUFFER_REQUEST;
 				*bb_size += _set_granularity(tmp_cnt, bb_pool);
 				xfree(bb_pool);
+			} else if (!xstrncmp(tok, "stage_out", 9)) {
+				have_stage_out = true;
 			}
 		}
 		tok = strtok_r(NULL, "\n", &save_ptr);
@@ -2422,6 +2424,11 @@ static int _parse_bb_opts(struct job_descriptor *job_desc, uint64_t *bb_size,
 	if (!have_bb)
 		rc = ESLURM_INVALID_BURST_BUFFER_REQUEST;
 
+	if (!have_stage_out) {
+		/* prevent sending stage out email */
+		job_desc->mail_type &= (~MAIL_JOB_STAGE_OUT);
+	}
+
 	return rc;
 }
 
-- 
GitLab