From f7d620d527fa0f6e66346d0b4fc38e81802836ec Mon Sep 17 00:00:00 2001 From: dev Date: Sat, 29 Oct 2005 17:56:32 +0000 Subject: [PATCH] add support for 'select' resource and version loading git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@44 3f5042e3-fb1d-0410-be18-d6ca2573e517 --- include/msched-version.h | 2 +- src/moab/MJob.c | 23 ++++++++++--- src/moab/MPBSI.c | 71 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 85 insertions(+), 11 deletions(-) diff --git a/include/msched-version.h b/include/msched-version.h index 737bf9e..e2f53d7 100644 --- a/include/msched-version.h +++ b/include/msched-version.h @@ -1 +1 @@ -#define MSCHED_VERSION "maui-3.2.6p14-snap.1129916435" +#define MSCHED_VERSION "maui-3.2.6p14-snap.1129921819" diff --git a/src/moab/MJob.c b/src/moab/MJob.c index b8cf420..7b40e9a 100644 --- a/src/moab/MJob.c +++ b/src/moab/MJob.c @@ -1230,9 +1230,10 @@ int MJobUpdateFlags( } } /* END if (RQ != NULL) */ - DBG(7,fSTRUCT) DPrint("INFO: job flags for job %s: %x\n", + DBG(7,fSTRUCT) DPrint("INFO: job flags for job %s: %x, req napolicy=%s\n", J->Name, - (int)J->Flags); + (int)J->Flags, + (RQ != NULL) ? MNAccessPolicy[RQ->NAccessPolicy] : "N/A"); /* update job attributes */ @@ -1311,17 +1312,21 @@ int MReqCheckResourceMatch( (J->ReqHList != NULL) && (RQ->DRes.Procs != 0)) { + Found = FALSE; + for (index = 0;J->ReqHList[index].N != NULL;index++) { if (N == J->ReqHList[index].N) { DBG(5,fSCHED) DPrint("INFO: node in requested hostlist\n"); - return(SUCCESS); + Found = TRUE; + + break; } } /* END for (index) */ - if ((J->ReqHList[index].N == NULL) && + if ((Found == FALSE) && ((J->ReqHLMode != mhlmSubset) || (MPar[0].EnableMultiNodeJobs == FALSE))) { @@ -1332,6 +1337,16 @@ int MReqCheckResourceMatch( return(FAILURE); } + + if ((Found == FALSE) && (J->ReqHLMode == mhlmExactSet)) + { + DBG(5,fSCHED) DPrint("INFO: node is not in specified hostlist\n"); + + if (RIndex != NULL) + *RIndex = marHostList; + + return(FAILURE); + } } /* END if ((J->Flags & (1 << mjfHostList)) && ... ) */ } /* END if (J != NULL) */ diff --git a/src/moab/MPBSI.c b/src/moab/MPBSI.c index 04e03fa..337afc2 100644 --- a/src/moab/MPBSI.c +++ b/src/moab/MPBSI.c @@ -1053,6 +1053,43 @@ int __MPBSSystemQuery( sizeof(MSched.DefaultC->Name)); } } + else if (!strcmp(AP->name,"pbs_version")) + { + char tmpLine[MMAX_LINE]; + + char *ptr; + char *TokPtr; + + int Version; + + /* FORMAT: _X.Y.Z. where is { PBSPro | TORQUE } */ + + if (R->Version <= 0) + { + MUStrCpy(tmpLine,AP->value,sizeof(tmpLine)); + + Version = 0; + + ptr = MUStrTok(tmpLine,"_",&TokPtr); + + ptr = MUStrTok(NULL,".",&TokPtr); + + if (ptr != NULL) + Version += (int)strtol(ptr,NULL,10) * 100; + + ptr = MUStrTok(NULL,".",&TokPtr); + + if (ptr != NULL) + Version += (int)strtol(ptr,NULL,10) * 10; + + ptr = MUStrTok(NULL,".",&TokPtr); + + if (ptr != NULL) + Version += (int)strtol(ptr,NULL,10); + + R->Version = Version; + } + } } /* END for (AP) */ } /* END for (SP) */ @@ -1481,7 +1518,8 @@ int MPBSLoadQueueInfo( } else if (!strcmp(AP->name,"resources_default")) { - if (!strcmp(AP->resource,"neednodes")) + if (!strcmp(AP->resource,"neednodes") || + !strcmp(AP->resource,"select")) { char *ptr; @@ -1749,7 +1787,14 @@ int MPBSJobStart( return(FAILURE); } - if (MPBSJobModify(J,R,ATTR_l,"neednodes",HostList,NULL,NULL) == FAILURE) + if (MPBSJobModify( + J, + R, + ATTR_l, + (char *)(R->Version >= 710) ? "select" : "neednodes", + HostList, + NULL, + NULL) == FAILURE) { DBG(0,fPBS) DPrint("ERROR: cannot set hostlist for job '%s'\n", J->Name); @@ -1880,7 +1925,14 @@ int MPBSJobStart( if (J->NeedNodes != NULL) { - if (MPBSJobModify(J,R,ATTR_l,"neednodes",J->NeedNodes,NULL,NULL) == FAILURE) + if (MPBSJobModify( + J, + R, + ATTR_l, + (char *)(R->Version >= 710) ? "select" : "neednodes", + J->NeedNodes, + NULL, + NULL) == FAILURE) { DBG(7,fPBS) DPrint("WARNING: cannot reset hostlist for job '%s')\n", J->Name); @@ -4428,7 +4480,14 @@ int MPBSJobRequeue( /* restore PBS 'neednodes' value to original value */ - if (MPBSJobModify(J,R,ATTR_l,"neednodes",J->NeedNodes,NULL,NULL) == FAILURE) + if (MPBSJobModify( + J, + R, + ATTR_l, + (char *)(R->Version >= 710) ? "select" : "neednodes", + J->NeedNodes, + NULL, + NULL) == FAILURE) { DBG(7,fPBS) DPrint("WARNING: cannot reset hostlist for job '%s')\n", J->Name); @@ -4864,7 +4923,7 @@ int MPBSJobMigrate( J, R, "Resource_List", - "neednodes", + (char *)(R->Version >= 710) ? "select" : "neednodes", tmpHList, EMsg, SC) == FAILURE) @@ -5448,7 +5507,7 @@ int MPBSJobSetAttr( /* get resource information */ - if (!strcmp(AP->resource,"neednodes")) + if (!strcmp(AP->resource,"neednodes") || !strcmp(AP->resource,"select")) { /* record PBS neednodes value */