From a81ffc7982afb1d31d0ef4bf944bc05c4f87dc65 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 1 May 2008 17:40:55 +0000
Subject: [PATCH] In sbatch and salloc, change --dependency's one letter option
 from "-d"  to "-P" (continue to accept "-d", but change the documentation).

---
 NEWS                     |  2 ++
 doc/man/man1/salloc.1    | 56 ++++++++++++++++++++--------------------
 doc/man/man1/sbatch.1    | 56 ++++++++++++++++++++--------------------
 src/salloc/opt.c         | 16 +++++++-----
 src/sbatch/opt.c         | 17 +++++++-----
 testsuite/expect/test8.6 |  2 +-
 6 files changed, 78 insertions(+), 71 deletions(-)

diff --git a/NEWS b/NEWS
index e453ceb90f0..353caa9fc80 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ documents those changes that are of interest to users and admins.
  -- Fix for memory size accounting on some architectures.
  -- NOTE: We needed to change an RPC from version 1.3.0. You must upgrade 
     all nodes in a cluster from v1.3.0 to v1.3.1 at the same time.
+ -- In sbatch and salloc, change --dependency's one letter option from "-d" 
+    to "-P" (continue to accept "-d", but change the documentation).
 
 * Changes in SLURM 1.3.1
 ========================
diff --git a/doc/man/man1/salloc.1 b/doc/man/man1/salloc.1
index 4f7872c0420..4da4bddb998 100644
--- a/doc/man/man1/salloc.1
+++ b/doc/man/man1/salloc.1
@@ -130,34 +130,6 @@ of 4 nodes, one for each of the 4 tasks.
 \fB\-D\fR, \fB\-\-chdir\fR=\fIpath\fR
 change directory to \fIpath\fR before beginning execution. 
 
-.TP 
-\fB\-d\fR, \fB\-\-dependency\fR[=]<\fIdependency_list\fR>
-Defer the start of this job until the specified dependencies have been
-satisfied completed.
-<\fIdependency_list\fR> is of the form 
-<\fItype:job_id[:job_id][,type:job_id[:job_id]]\fR>.
-Many jobs can share the same dependency and these jobs may even belong to
-different  users. The  value may be changed after job submission using the
-scontrol command.
-.PD
-.RS
-.TP
-\fBafter:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have begun
-execution.
-.TP
-\fBafterany:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have terminated.
-.TP
-\fBafternotok:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have terminated
-in some failed state (non-zero exit code, node failure, timed out, etc).
-.TP
-\fBafterok:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have successfully
-executed (ran to completion with non-zero exit code).
-.RE
-
 .TP
 \fB\-\-exclusive\fR
 The job allocation cannot share nodes with other running jobs.  This is
@@ -453,6 +425,34 @@ Request a specific partition for the resource allocation.  If not specified,
 the default behaviour is to allow the slurm controller to select the default
 partition as designated by the system administrator.
 
+.TP 
+\fB\-P\fR, \fB\-\-dependency\fR[=]<\fIdependency_list\fR>
+Defer the start of this job until the specified dependencies have been
+satisfied completed.
+<\fIdependency_list\fR> is of the form 
+<\fItype:job_id[:job_id][,type:job_id[:job_id]]\fR>.
+Many jobs can share the same dependency and these jobs may even belong to
+different  users. The  value may be changed after job submission using the
+scontrol command.
+.PD
+.RS
+.TP
+\fBafter:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have begun
+execution.
+.TP
+\fBafterany:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have terminated.
+.TP
+\fBafternotok:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have terminated
+in some failed state (non-zero exit code, node failure, timed out, etc).
+.TP
+\fBafterok:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have successfully
+executed (ran to completion with non-zero exit code).
+.RE
+
 .TP
 \fB\-q\fR, \fB\-\-quiet\fR
 Suppress informational messages from salloc. Errors will still be displayed.
diff --git a/doc/man/man1/sbatch.1 b/doc/man/man1/sbatch.1
index 63b901d81df..e73830f66e4 100644
--- a/doc/man/man1/sbatch.1
+++ b/doc/man/man1/sbatch.1
@@ -132,34 +132,6 @@ Demand a contiguous range of nodes. The default is "yes". Specify
 Set the working directory of the batch script to \fIdirectory\fR before
 it it executed.
 
-.TP 
-\fB\-d\fR, \fB\-\-dependency\fR[=]<\fIdependency_list\fR>
-Defer the start of this job until the specified dependencies have been
-satisfied completed.
-<\fIdependency_list\fR> is of the form 
-<\fItype:job_id[:job_id][,type:job_id[:job_id]]\fR>.
-Many jobs can share the same dependency and these jobs may even belong to
-different  users. The  value may be changed after job submission using the
-scontrol command.
-.PD
-.RS
-.TP
-\fBafter:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have begun
-execution.
-.TP
-\fBafterany:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have terminated.
-.TP
-\fBafternotok:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have terminated
-in some failed state (non-zero exit code, node failure, timed out, etc).
-.TP
-\fBafterok:job_id[:jobid...]\fR
-This job can begin execution after the specified jobs have successfully
-executed (ran to completion with non-zero exit code).
-.RE
-
 .TP
 \fB\-e\fR, \fB\-\-error\fR[=]<\fIfilename pattern\fR>
 Instruct SLURM to connect the batch script's standard error directly to the 
@@ -533,6 +505,34 @@ The maximum resident set size
 The maximum stack size
 .RE
 
+.TP 
+\fB\-P\fR, \fB\-\-dependency\fR[=]<\fIdependency_list\fR>
+Defer the start of this job until the specified dependencies have been
+satisfied completed.
+<\fIdependency_list\fR> is of the form 
+<\fItype:job_id[:job_id][,type:job_id[:job_id]]\fR>.
+Many jobs can share the same dependency and these jobs may even belong to
+different  users. The  value may be changed after job submission using the
+scontrol command.
+.PD
+.RS
+.TP
+\fBafter:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have begun
+execution.
+.TP
+\fBafterany:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have terminated.
+.TP
+\fBafternotok:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have terminated
+in some failed state (non-zero exit code, node failure, timed out, etc).
+.TP
+\fBafterok:job_id[:jobid...]\fR
+This job can begin execution after the specified jobs have successfully
+executed (ran to completion with non-zero exit code).
+.RE
+
 .TP
 \fB\-q\fR, \fB\-\-quiet\fR
 Suppress informational messages from sbatch. Errors will still be displayed.
diff --git a/src/salloc/opt.c b/src/salloc/opt.c
index c97e3f06216..652c91eb6d2 100644
--- a/src/salloc/opt.c
+++ b/src/salloc/opt.c
@@ -475,7 +475,6 @@ void set_options(const int argc, char **argv)
 		{"extra-node-info", required_argument, 0, 'B'},
 		{"cpus-per-task", required_argument, 0, 'c'},
 		{"constraint",    required_argument, 0, 'C'},
-		{"dependency",    required_argument, 0, 'd'},
 		{"chdir",         required_argument, 0, 'D'},
 		{"nodefile",      required_argument, 0, 'F'},
 		{"geometry",      required_argument, 0, 'g'},
@@ -492,6 +491,7 @@ void set_options(const int argc, char **argv)
 		{"nodes",         required_argument, 0, 'N'},
 		{"overcommit",    no_argument,       0, 'O'},
 		{"partition",     required_argument, 0, 'p'},
+		{"dependency",    required_argument, 0, 'P'},
 		{"quiet",         no_argument,       0, 'q'},
 		{"no-rotate",     no_argument,       0, 'R'},
 		{"share",         no_argument,       0, 's'},
@@ -542,7 +542,7 @@ void set_options(const int argc, char **argv)
 		{"get-user-env",  optional_argument, 0, LONG_OPT_GET_USER_ENV},
 		{NULL,            0,                 0, 0}
 	};
-	char *opt_string = "+a:B:c:C:d:D:F:g:hHIJ:kK:L:m:n:N:Op:qR:st:uU:vVw:W:x:";
+	char *opt_string = "+a:B:c:C:d:D:F:g:hHIJ:kK:L:m:n:N:Op:P:qR:st:uU:vVw:W:x:";
 
 	opt.progname = xbasename(argv[0]);
 	optind = 0;		
@@ -582,10 +582,7 @@ void set_options(const int argc, char **argv)
 			xfree(opt.constraints);
 			opt.constraints = xstrdup(optarg);
 			break;
-		case 'd':
-			xfree(opt.dependency);
-			opt.dependency = xstrdup(optarg);
-			break;
+/* 		case 'd':	see 'P' below */
 		case 'D':
 			xfree(opt.cwd);
 			opt.cwd = xstrdup(optarg);
@@ -663,6 +660,11 @@ void set_options(const int argc, char **argv)
 			xfree(opt.partition);
 			opt.partition = xstrdup(optarg);
 			break;
+		case 'd':
+		case 'P':
+			xfree(opt.dependency);
+			opt.dependency = xstrdup(optarg);
+			break;
 		case 'q':
 			opt.quiet++;
 			break;
@@ -1369,7 +1371,7 @@ static void _help(void)
 "                              immediately available\n"
 "  -v, --verbose               verbose mode (multiple -v's increase verbosity)\n"
 "  -q, --quiet                 quiet mode (suppress informational messages)\n"
-"  -d, --dependency=type:jobid defer job until condition on jobid is satisfied\n"
+"  -P, --dependency=type:jobid defer job until condition on jobid is satisfied\n"
 "      --nice[=value]          decrease secheduling priority by value\n"
 "  -U, --account=name          charge job to specified account\n"
 "      --begin=time            defer job until HH:MM DD/MM/YY\n"
diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c
index a239fb825ca..881c6691f37 100644
--- a/src/sbatch/opt.c
+++ b/src/sbatch/opt.c
@@ -474,7 +474,6 @@ static struct option long_options[] = {
 	{"extra-node-info", required_argument, 0, 'B'},
 	{"cpus-per-task", required_argument, 0, 'c'},
 	{"constraint",    required_argument, 0, 'C'},
-	{"dependency",    required_argument, 0, 'd'},
 	{"workdir",       required_argument, 0, 'D'},
 	{"error",         required_argument, 0, 'e'},
 	{"nodefile",      required_argument, 0, 'F'},
@@ -493,6 +492,7 @@ static struct option long_options[] = {
 	{"output",        required_argument, 0, 'o'},
 	{"overcommit",    no_argument,       0, 'O'},
 	{"partition",     required_argument, 0, 'p'},
+	{"dependency",    required_argument, 0, 'P'},
 	{"quiet",         no_argument,       0, 'q'},
 	{"no-rotate",     no_argument,       0, 'R'},
 	{"share",         no_argument,       0, 's'},
@@ -546,7 +546,7 @@ static struct option long_options[] = {
 };
 
 static char *opt_string =
-	"+a:bB:c:C:d:D:e:F:g:hHi:IJ:kL:m:n:N:o:Op:qR:st:uU:vVw:x:";
+	"+a:bB:c:C:d:D:e:F:g:hHi:IJ:kL:m:n:N:o:Op:P:qR:st:uU:vVw:x:";
 
 
 /*
@@ -946,10 +946,7 @@ static void _set_options(int argc, char **argv)
 			xfree(opt.constraints);
 			opt.constraints = xstrdup(optarg);
 			break;
-		case 'd':
-			xfree(opt.dependency);
-			opt.dependency = xstrdup(optarg);
-			break;
+/*		case 'd': See 'P' below */
 		case 'D':
 			xfree(opt.cwd);
 			opt.cwd = xstrdup(optarg);
@@ -1042,6 +1039,12 @@ static void _set_options(int argc, char **argv)
 			xfree(opt.partition);
 			opt.partition = xstrdup(optarg);
 			break;
+		case 'd':
+		case 'P':
+			/* use -P instead */
+			xfree(opt.dependency);
+			opt.dependency = xstrdup(optarg);
+			break;
 		case 'q':
 			opt.quiet++;
 			break;
@@ -2151,7 +2154,7 @@ static void _help(void)
 "      --jobid=id              run under already allocated job\n"
 "  -v, --verbose               verbose mode (multiple -v's increase verbosity)\n"
 "  -q, --quiet                 quiet mode (suppress informational messages)\n"
-"  -d, --dependency=type:jobid defer job until condition on jobid is satisfied\n"
+"  -P, --dependency=type:jobid defer job until condition on jobid is satisfied\n"
 "  -D, --workdir=directory     set working directory for batch script\n"
 "      --nice[=value]          decrease secheduling priority by value\n"
 "  -O, --overcommit            overcommit resources\n"
diff --git a/testsuite/expect/test8.6 b/testsuite/expect/test8.6
index 9af5d7dd601..91c0ef46e43 100755
--- a/testsuite/expect/test8.6
+++ b/testsuite/expect/test8.6
@@ -105,7 +105,7 @@ proc wait_for_all_jobs { job_name } {
 
 	set last_matches 0
 	send_user "Waiting for all jobs to terminate\n"
-	for {set inx 0} {$inx < 60} {incr inx} {
+	for {set inx 0} {$inx < 600} {incr inx} {
 		set matches 0
 		log_user 0
 		spawn $squeue -o %j
-- 
GitLab