X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fweighted-round-robin-worker-choice-strategy.ts;h=df45feb3829a4972962d1f51aeeb1e7bcfbc1d7d;hb=802983837716dc38305c13f905a1977688365293;hp=bda206a7d7e1521ac8a6056b0485ad18e7698375;hpb=49be33feded000ed776ee589274e154fa519b263;p=poolifier.git diff --git a/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts b/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts index bda206a7..df45feb3 100644 --- a/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts @@ -28,7 +28,10 @@ export class WeightedRoundRobinWorkerChoiceStrategy< public readonly requiredStatistics: RequiredStatistics = { runTime: true, avgRunTime: true, - medRunTime: false + medRunTime: false, + waitTime: false, + avgWaitTime: false, + medWaitTime: false } /** @@ -75,7 +78,7 @@ export class WeightedRoundRobinWorkerChoiceStrategy< if (workerVirtualTaskRunTime < workerWeight) { this.workerVirtualTaskRunTime = workerVirtualTaskRunTime + - this.getWorkerVirtualTaskRunTime(chosenWorkerNodeKey) + this.getWorkerTaskRunTime(chosenWorkerNodeKey) } else { this.currentWorkerNodeId = this.currentWorkerNodeId === this.pool.workerNodes.length - 1 @@ -99,12 +102,6 @@ export class WeightedRoundRobinWorkerChoiceStrategy< return true } - private getWorkerVirtualTaskRunTime (workerNodeKey: number): number { - return this.requiredStatistics.medRunTime - ? this.pool.workerNodes[workerNodeKey].tasksUsage.medRunTime - : this.pool.workerNodes[workerNodeKey].tasksUsage.avgRunTime - } - private computeDefaultWorkerWeight (): number { let cpusCycleTimeWeight = 0 for (const cpu of cpus()) {