)
}),
busyWorkerNodes: this.workerNodes.reduce(
- (accumulator, _workerNode, workerNodeKey) =>
+ (accumulator, _, workerNodeKey) =>
this.isWorkerNodeBusy(workerNodeKey) ? accumulator + 1 : accumulator,
0
),
)
})
}
+ }),
+ ...(this.workerChoiceStrategiesContext?.getTaskStatisticsRequirements()
+ .elu.aggregate === true && {
+ elu: {
+ idle: {
+ minimum: round(
+ min(
+ ...this.workerNodes.map(
+ workerNode => workerNode.usage.elu.idle.minimum ?? Infinity
+ )
+ )
+ ),
+ maximum: round(
+ max(
+ ...this.workerNodes.map(
+ workerNode => workerNode.usage.elu.idle.maximum ?? -Infinity
+ )
+ )
+ ),
+ ...(this.workerChoiceStrategiesContext.getTaskStatisticsRequirements()
+ .elu.average && {
+ average: round(
+ average(
+ this.workerNodes.reduce<number[]>(
+ (accumulator, workerNode) =>
+ accumulator.concat(workerNode.usage.elu.idle.history),
+ []
+ )
+ )
+ )
+ }),
+ ...(this.workerChoiceStrategiesContext.getTaskStatisticsRequirements()
+ .elu.median && {
+ median: round(
+ median(
+ this.workerNodes.reduce<number[]>(
+ (accumulator, workerNode) =>
+ accumulator.concat(workerNode.usage.elu.idle.history),
+ []
+ )
+ )
+ )
+ })
+ },
+ active: {
+ minimum: round(
+ min(
+ ...this.workerNodes.map(
+ workerNode => workerNode.usage.elu.active.minimum ?? Infinity
+ )
+ )
+ ),
+ maximum: round(
+ max(
+ ...this.workerNodes.map(
+ workerNode => workerNode.usage.elu.active.maximum ?? -Infinity
+ )
+ )
+ ),
+ ...(this.workerChoiceStrategiesContext.getTaskStatisticsRequirements()
+ .elu.average && {
+ average: round(
+ average(
+ this.workerNodes.reduce<number[]>(
+ (accumulator, workerNode) =>
+ accumulator.concat(workerNode.usage.elu.active.history),
+ []
+ )
+ )
+ )
+ }),
+ ...(this.workerChoiceStrategiesContext.getTaskStatisticsRequirements()
+ .elu.median && {
+ median: round(
+ median(
+ this.workerNodes.reduce<number[]>(
+ (accumulator, workerNode) =>
+ accumulator.concat(workerNode.usage.elu.active.history),
+ []
+ )
+ )
+ )
+ })
+ }
+ }
})
}
}
}
this.destroying = true
await Promise.all(
- this.workerNodes.map(async (_workerNode, workerNodeKey) => {
+ this.workerNodes.map(async (_, workerNodeKey) => {
await this.destroyWorkerNode(workerNodeKey)
})
)
readonly average?: number
readonly median?: number
}
+ readonly elu?: {
+ idle: {
+ readonly minimum: number
+ readonly maximum: number
+ readonly average?: number
+ readonly median?: number
+ }
+ active: {
+ readonly minimum: number
+ readonly maximum: number
+ readonly average?: number
+ readonly median?: number
+ }
+ }
}
/**