From 8f1cc9886a2731797a25f5e09856c59e3fcc410d Mon Sep 17 00:00:00 2001 From: wightman Date: Mon, 4 Sep 2006 16:35:35 +0000 Subject: [PATCH] enable PercentBasedFS git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@67 3f5042e3-fb1d-0410-be18-d6ca2573e517 --- include/msched.h | 1 + src/moab/MFS.c | 3 ++ src/moab/MPar.c | 5 +++ src/moab/MPriority.c | 75 +++++++++++++++++++++++++++++++++++--------- 4 files changed, 69 insertions(+), 15 deletions(-) diff --git a/include/msched.h b/include/msched.h index 1c04bed..35238d3 100644 --- a/include/msched.h +++ b/include/msched.h @@ -2160,6 +2160,7 @@ typedef struct { int SPVJobIsPreemptible; /* (config boolean) */ mbool_t EnableEncryption; + mbool_t PercentBasedFS; char *Argv[MAX_MARG]; diff --git a/src/moab/MFS.c b/src/moab/MFS.c index 279279f..50195cc 100644 --- a/src/moab/MFS.c +++ b/src/moab/MFS.c @@ -886,6 +886,9 @@ int MFSProcessOConfig( case pFSPolicy: + if (strchr(SVal,'*')) + MSched.PercentBasedFS = TRUE; + if (MUBoolFromString(SVal,FALSE) == TRUE) { /* enable backlevel support */ diff --git a/src/moab/MPar.c b/src/moab/MPar.c index 4b3da58..c7dafd2 100644 --- a/src/moab/MPar.c +++ b/src/moab/MPar.c @@ -2462,6 +2462,11 @@ int MParConfigShow( sprintf(Buffer,"%s%-30s %s\n",Buffer,MParam[pFSPolicy],MFSPolicyType[F->FSPolicy]); + sprintf(Buffer,"%s%-30s %s%s\n", + Buffer, + MParam[pFSPolicy],MFSPolicyType[F->FSPolicy], + (MSched.PercentBasedFS == TRUE) ? "%" : ""); + if ((F->FSPolicy == fspNONE) || (VFlag || (PIndex == -1) || (PIndex == pFSPolicy))) { sprintf(Buffer,"%s%-30s %s\n",Buffer,MParam[pFSInterval],MULToTString(F->FSInterval)); diff --git a/src/moab/MPriority.c b/src/moab/MPriority.c index efca285..964259d 100644 --- a/src/moab/MPriority.c +++ b/src/moab/MPriority.c @@ -761,9 +761,18 @@ int MJobGetStartPriority( if (FSTargetUsage > 0.0) { - SFactor[mpsFU] = FSTargetUsage - - (J->Cred.U->F.FSUsage[0] + J->Cred.U->F.FSFactor) / - (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + if (MSched.PercentBasedFS == TRUE) + { + SFactor[mpsFU] = 1.0 - + (((J->Cred.U->F.FSUsage[0] + J->Cred.U->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0)/FSTargetUsage); + } + else + { + SFactor[mpsFU] = FSTargetUsage - + (J->Cred.U->F.FSUsage[0] + J->Cred.U->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + } switch(FSMode) { @@ -797,9 +806,18 @@ int MJobGetStartPriority( if (FSTargetUsage > 0.0) { - SFactor[mpsFG] = FSTargetUsage - - (J->Cred.G->F.FSUsage[0] + J->Cred.G->F.FSFactor) / - (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + if (MSched.PercentBasedFS == TRUE) + { + SFactor[mpsFU] = 1.0 - + (((J->Cred.G->F.FSUsage[0] + J->Cred.G->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0)/FSTargetUsage); + } + else + { + SFactor[mpsFG] = FSTargetUsage - + (J->Cred.G->F.FSUsage[0] + J->Cred.G->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + } switch(FSMode) { @@ -833,9 +851,18 @@ int MJobGetStartPriority( { if (J->Cred.A != NULL) { - SFactor[mpsFA] = FSTargetUsage - - (J->Cred.A->F.FSUsage[0] + J->Cred.A->F.FSFactor) / - (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + if (MSched.PercentBasedFS == TRUE) + { + SFactor[mpsFA] = 1.0 - + (((J->Cred.A->F.FSUsage[0] + J->Cred.A->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0)/FSTargetUsage); + } + else + { + SFactor[mpsFA] = FSTargetUsage - + (J->Cred.A->F.FSUsage[0] + J->Cred.A->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + } } else { @@ -873,9 +900,18 @@ int MJobGetStartPriority( { if (J->Cred.C != NULL) { - SFactor[mpsFC] = FSTargetUsage - - (J->Cred.C->F.FSUsage[0] + J->Cred.C->F.FSFactor) / - (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + if (MSched.PercentBasedFS == TRUE) + { + SFactor[mpsFC] = 1.0 - + (((J->Cred.C->F.FSUsage[0] + J->Cred.C->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0)/FSTargetUsage); + } + else + { + SFactor[mpsFC] = FSTargetUsage - + (J->Cred.C->F.FSUsage[0] + J->Cred.C->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + } } else { @@ -913,9 +949,18 @@ int MJobGetStartPriority( { if (J->Cred.Q != NULL) { - SFactor[mpsFQ] = FSTargetUsage - - (J->Cred.Q->F.FSUsage[0] + J->Cred.Q->F.FSFactor) / - (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + if (MSched.PercentBasedFS == TRUE) + { + SFactor[mpsFQ] = 1.0 - + (((J->Cred.Q->F.FSUsage[0] + J->Cred.Q->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0)/FSTargetUsage); + } + else + { + SFactor[mpsFQ] = FSTargetUsage - + (J->Cred.Q->F.FSUsage[0] + J->Cred.Q->F.FSFactor) / + (GP->F.FSUsage[0] + GP->F.FSFactor) * 100.0; + } } else {