[torquedev] feature request: server job id bounds

Toni L. Harbaugh-Blackford [Contr] harbaugh at abcc.ncifcrf.gov
Tue Jan 30 06:10:24 MST 2007


At my site I have a multi server setup in which I need to make sure
that the job ids assigned by the server never overlap.   The next_job_number
server attribute is useful for initially setting the job number, but
does not provide an upper bound to prevent overlap.  It also does
not handle rollover.

Below is a patch that provides a command line argument which sets
the upper and lower bounds for server assignment of job ids.  I have
tested it on several systems at my site and it seems stable.  I
would appreciate it if the patch could be incorporated into torque
in the future.

Thanks,
Toni


--- torque-2.2.0-snap.200611291634/src/server/pbsd_init.c_orig	2006-11-07 20:34:41.000000000 -0500
+++ torque-2.2.0-snap.200611291634/src/server/pbsd_init.c	2006-12-07 08:42:26.000000000 -0500
@@ -142,6 +142,7 @@

 /* global Data Items */

+extern int	 pbs_server_jid_range_lower;
 extern char	*msg_startup3;
 extern char     *msg_daemonname;
 extern char	*msg_init_abt;
@@ -543,6 +544,7 @@
       /* (y)es response received */

       rm_files(path_priv);
+      server.sv_qs.sv_jobidnumber = pbs_server_jid_range_lower;

       svr_save(&server,SVR_SAVE_FULL);
       }
--- torque-2.2.0-snap.200611291634/src/server/pbsd_main.c_orig	2006-11-29 18:34:48.000000000 -0500
+++ torque-2.2.0-snap.200611291634/src/server/pbsd_main.c	2007-01-30 07:18:42.000000000 -0500
@@ -153,6 +153,8 @@

 /* Global Data Items */

+int	 	pbs_server_jid_range_lower = 0;
+int	 	pbs_server_jid_range_upper = PBS_SEQNUMTOP;
 char	       *acct_file = NULL;
 char	       *log_file  = NULL;
 char	       *path_home = PBS_SERVER_HOME;
@@ -537,7 +539,7 @@

   /* parse the parameters from the command line */

-  while ((c = getopt(argc,argv,"A:a:d:fh:p:t:L:M:R:S:-:")) != -1)
+  while ((c = getopt(argc,argv,"A:a:d:fh:p:t:L:B:M:R:S:-:")) != -1)
     {
     switch (c)
       {
@@ -744,6 +746,32 @@

         break;

+      case 'B':
+
+         if ((pc = strchr(optarg, (int)':')) == NULL) {
+           fprintf(stderr,"%s: bad -B %s, not specifed as range\n", argv[0], optarg);
+           return(1);
+         }
+
+         *pc = '\0';
+
+         if ((pbs_server_jid_range_lower = atoi(optarg)) < 0) {
+           fprintf(stderr,"%s: bad -B %s, range start must be >= 0\n", argv[0], optarg);
+           return(1);
+         }
+
+         if ((pbs_server_jid_range_upper = atoi(pc+1)) <= pbs_server_jid_range_lower ) {
+           fprintf(stderr,"%s: bad -B %s, range end must be >%d and <=%d\n", argv[0], pbs_server_jid_range_lower, PBS_SEQNUMTOP);
+           return(1);
+         }
+
+         if (pbs_server_jid_range_upper > PBS_SEQNUMTOP) {
+           fprintf(stderr,"%s: bad -B %s, range end must be <= %d\n", argv[0], pc+1,PBS_SEQNUMTOP);
+           return(1);
+         }
+
+        break;
+
       case 'M':

         if (get_port(optarg,&pbs_mom_port,&pbs_mom_addr))
--- torque-2.2.0-snap.200611291634/src/server/req_quejob.c_orig	2006-11-18 23:44:36.000000000 -0500
+++ torque-2.2.0-snap.200611291634/src/server/req_quejob.c	2006-12-07 08:37:56.000000000 -0500
@@ -169,6 +169,8 @@

 extern  char *msg_daemonname;

+extern int	 pbs_server_jid_range_lower;
+extern int	 pbs_server_jid_range_upper;


 /* Private Functions in this file */
@@ -274,8 +276,8 @@

     /* having updated sv_jobidnumber, must save server struct */

-    if (++server.sv_qs.sv_jobidnumber > PBS_SEQNUMTOP)
-      server.sv_qs.sv_jobidnumber = 0;	/* wrap it */
+    if (++server.sv_qs.sv_jobidnumber > pbs_server_jid_range_upper)
+      server.sv_qs.sv_jobidnumber = pbs_server_jid_range_lower;	/* wrap it */

     if (svr_save(&server,SVR_SAVE_QUICK))
       {


-------------------------------------------------------------------
Toni Harbaugh-Blackford                   harbaugh at abcc.ncifcrf.gov
System Administrator
Advanced Biomedical Computing Center (ABCC)
National Cancer Institute
Contractor - SAIC/Frederick


More information about the torquedev mailing list