From 3b7006bec56e3140bb8d28aabcb0e98bedd4bcaf Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 1 Feb 2007 18:44:13 +0000
Subject: [PATCH] Add parsing/processing of SLAUNCH_PROLOG, SLAUNCH_EPILOG,
 SLAUNCH_TASK_PROLOG, and SLAUNCH_TASK_EPILOG environment variables.

---
 doc/man/man1/slaunch.1 | 12 +++++++
 doc/man/man1/srun.1    | 73 +++++++++++++++++++++---------------------
 src/slaunch/opt.c      |  5 +++
 3 files changed, 54 insertions(+), 36 deletions(-)

diff --git a/doc/man/man1/slaunch.1 b/doc/man/man1/slaunch.1
index 2073946f1f0..405b23ce991 100644
--- a/doc/man/man1/slaunch.1
+++ b/doc/man/man1/slaunch.1
@@ -553,6 +553,9 @@ Same as \fB\-v\fR or \fB\-\-verbose\fR.
 \fBSLAUNCH_DISTRIBUTION\fR
 Same as \fB\-m\fR or \fB\-\-distribution\fR.
 .TP
+\fBSLAUNCH_EPILOG\fR
+Same as \fB\-\-epilog\fR=\fIexecutable\fR.
+.TP
 \fBSLAUNCH_JOBID\fR
 Same as \fB\-\-jobid\fR.
 .TP
@@ -571,6 +574,15 @@ Same as \fB\-\-mpi\fR.
 \fBSLAUNCH_OVERCOMMIT\fR
 Same as \fB\-C\fR or \fB\-\-overcomit\fR.
 .TP
+\fBSLAUNCH_PROLOG\fR
+Same as \fB\-\-prolog\fR=\fIexecutable\fR.
+.TP
+\fBSLAUNCH_TASK_EPILOG\fR
+Same as \fB\-\-task\-epilog\fR=\fIexecutable\fR.
+.TP
+\fBSLAUNCH_TASK_PROLOG\fR
+Same as \fB\-\-task\-prolog\fR=\fIexecutable\fR.
+.TP
 \fBSLAUNCH_WAIT\fR
 Same as \fB\-W\fR or \fB\-\-wait\fR.
 .TP
diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1
index 6e1fd947bb8..193ba2461d1 100644
--- a/doc/man/man1/srun.1
+++ b/doc/man/man1/srun.1
@@ -1140,108 +1140,109 @@ Note: Command line options will always override these settings.
 The location of the SLURM configuration file.
 .TP
 \fBSLURM_ACCOUNT\fR
-\fB\-U, \-\-account\fR=\fIaccount\fR
+Same as \fB\-U, \-\-account\fR=\fIaccount\fR
 .TP
 \fBSLURM_CPU_BIND\fR
-\fB\-\-cpu_bind\fR=\fItype\fR
+Same as \fB\-\-cpu_bind\fR=\fItype\fR
 .TP
 \fBSLURM_CPUS_PER_TASK\fR
-\fB\-c, \-\-ncpus\-per\-task\fR=\fIn\fR
+Same as \fB\-c, \-\-ncpus\-per\-task\fR=\fIn\fR
 .TP
 \fBSLURM_CONN_TYPE\fR
-\fB\-\-conn\-type\fR=(\fImesh|nav|torus\fR)
+Same as \fB\-\-conn\-type\fR=(\fImesh|nav|torus\fR)
 .TP
 \fBSLURM_CORE_FORMAT\fR
-\fB\-\-core\fR=\fIformat\fR
+Same as \fB\-\-core\fR=\fIformat\fR
 .TP
 \fBSLURM_DEBUG\fR
-\fB\-v, \-\-verbose\fR
+Same as \fB\-v, \-\-verbose\fR
 .TP
 \fBSLURMD_DEBUG\fR
-\fB\-d, \-\-slurmd\-debug\fR
+Same as \fB\-d, \-\-slurmd\-debug\fR
 .TP
 \fBSLURM_DISABLE_STATUS\fR
-\fB\-X, \-\-disable\-status\fR
+Same as \fB\-X, \-\-disable\-status\fR
 .TP
 \fBSLURM_DIST_PLANESIZE\fR
-\fB\-m plane\fR
+Same as \fB\-m plane\fR
 .TP
 \fBSLURM_DISTRIBUTION\fR
-\fB\-m, \-\-distribution\fR=(\fIblock|cyclic|hostfile\fR)
+Same as \fB\-m, \-\-distribution\fR=(\fIblock|cyclic|hostfile\fR)
 .TP
 \fBSLURM_EPILOG\fR
-\fB\-\-epilog\fR=\fIexecutable\fR
+Same as \fB\-\-epilog\fR=\fIexecutable\fR
 .TP
 \fBSLURM_GEOMETRY\fR
-\fB\-g, \-\-geometry\fR=\fIX,Y,Z\fR
+Same as \fB\-g, \-\-geometry\fR=\fIX,Y,Z\fR
 .TP
 \fBSLURM_LABELIO\fR
-\fB\-l, \-\-label\fR
-\fBSLURM_UNBUFFEREDIO\fR
-\fB-u, --unbuffered\fR
+Same as \fB\-l, \-\-label\fR
 .TP
 \fBSLURM_MEM_BIND\fR
-\fB\-\-mem_bind\fR=\fItype\fR
+Same as \fB\-\-mem_bind\fR=\fItype\fR
 .TP
 \fBSLURM_NETWORK\fR
-\fB\-\-network\fR=\fItype\fR
+Same as \fB\-\-network\fR=\fItype\fR
 .TP
 \fBSLURM_NNODES\fR
-\fB\-N, \-\-nodes\fR=(\fIn|min\-max\fR)
+Same as \fB\-N, \-\-nodes\fR=(\fIn|min\-max\fR)
 .TP
 \fBSLURN_NTASKS_PER_CORE\fR
-\fB\-\-ntasks\-per\-core\fR
+Same as \fB\-\-ntasks\-per\-core\fR
 .TP
 \fBSLURN_NTASKS_PER_NODE\fR
-\fB\-\-ntasks\-per\-node\fRa
+Same as \fB\-\-ntasks\-per\-node\fRa
 .TP
 \fBSLURN_NTASKS_PER_SOCKET\fR
-\fB\-\-ntasks\-per\-socket\fRa
+Same as \fB\-\-ntasks\-per\-socket\fRa
 .TP
 \fBSLURM_NO_REQUEUE\fR
-\fB\-\-no\-requeue\fR
+Same as \fB\-\-no\-requeue\fR
 .TP
 \fBSLURM_NO_ROTATE\fR
-\fB\-\-no\-rotate\fR
+Same as \fB\-\-no\-rotate\fR
 .TP
 \fBSLURM_NPROCS\fR
-\fB\-n, \-\-ntasks\fR=\fIn\fR
+Same as \fB\-n, \-\-ntasks\fR=\fIn\fR
 .TP
 \fBSLURM_OVERCOMMIT\fR
-\fB\-o, \-\-overcommit\fR
+Same as \fB\-o, \-\-overcommit\fR
 .TP
 \fBSLURM_PARTITION\fR
-\fB\-p, \-\-partition\fR=\fIpartition\fR
+Same as \fB\-p, \-\-partition\fR=\fIpartition\fR
 .TP
 \fBSLURM_PROLOG\fR
-\fB\-\-prolog\fR=\fIexecutable\fR
+Same as \fB\-\-prolog\fR=\fIexecutable\fR
 .TP
 \fBSLURM_REMOTE_CWD\fR
-\fB\-D, \-\-chdir=\fR=\fIdir\fR
+Same as \fB\-D, \-\-chdir=\fR=\fIdir\fR
 .TP
 \fBSLURM_SRUN_COMM_IFHN\fR
-\fB\-\-ctrl\-comm\-ifhn\fR=\fIaddr\fR
+Same as \fB\-\-ctrl\-comm\-ifhn\fR=\fIaddr\fR
 .TP
 \fBSLURM_STDERRMODE\fR
-\fB\-e, \-\-error\fR=\fImode\fR
+Same as \fB\-e, \-\-error\fR=\fImode\fR
 .TP
 \fBSLURM_STDINMODE\fR
-\fB\-i, \-\-input\fR=\fImode\fR
+Same as \fB\-i, \-\-input\fR=\fImode\fR
 .TP
 \fBSLURM_STDOUTMODE\fR
-\fB\-o, \-\-output\fR=\fImode\fR
+Same as \fB\-o, \-\-output\fR=\fImode\fR
 .TP
 \fBSLURM_TASK_EPILOG\fR
-\fB\-\-task\-epilog\fR=\fIexecutable\fR
+Same as \fB\-\-task\-epilog\fR=\fIexecutable\fR
 .TP
 \fBSLURM_TASK_PROLOG\fR
-\fB\-\-task\-prolog\fR=\fIexecutable\fR
+Same as \fB\-\-task\-prolog\fR=\fIexecutable\fR
 .TP
 \fBSLURM_TIMELIMIT\fR
-\fB\-t, \-\-time\fR=\fIminutes\fR
+Same as \fB\-t, \-\-time\fR=\fIminutes\fR
+.TP
+\fBSLURM_UNBUFFEREDIO\fR
+Same as \fB-u, --unbuffered\fR
 .TP
 \fBSLURM_WAIT\fR
-\fB\-W, \-\-wait\fR=\fIseconds\fR
+Same as \fB\-W, \-\-wait\fR=\fIseconds\fR
 
 .PP
 Additionally, srun will set some environment variables in the environment 
diff --git a/src/slaunch/opt.c b/src/slaunch/opt.c
index b246d36f5ec..d013cf34fca 100644
--- a/src/slaunch/opt.c
+++ b/src/slaunch/opt.c
@@ -765,6 +765,11 @@ env_vars_t env_vars[] = {
   {"SLAUNCH_WAIT",         OPT_INT,       &opt.max_wait,      NULL           },
   {"SLAUNCH_MPI_TYPE",     OPT_MPI,       NULL,               NULL           },
   {"SLAUNCH_COMM_HOSTNAME",OPT_STRING,    &opt.comm_hostname, NULL           },
+  {"SLAUNCH_PROLOG",       OPT_STRING,    &opt.prolog,        NULL           },
+  {"SLAUNCH_EPILOG",       OPT_STRING,    &opt.epilog,        NULL           },
+  {"SLAUNCH_TASK_PROLOG",  OPT_STRING,    &opt.task_prolog,   NULL           },
+  {"SLAUNCH_TASK_EPILOG",  OPT_STRING,    &opt.task_epilog,   NULL           },
+
   {NULL, 0, NULL, NULL}
 };
 
-- 
GitLab