import { cpus } from 'node:os'
-import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
+import {
+ DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+ DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
+} from '../../utils'
import type { IPool } from '../pool'
import type { IWorker } from '../worker'
import type {
/** @inheritDoc */
public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
- runTime: {
- aggregate: false,
- average: false,
- median: false
- },
- waitTime: {
- aggregate: false,
- average: false,
- median: false
- },
- elu: {
- aggregate: false,
- average: false,
- median: false
- }
+ runTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+ waitTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+ elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS
}
/**
*/
protected getWorkerTaskRunTime (workerNodeKey: number): number {
return this.taskStatisticsRequirements.runTime.median
- ? this.pool.workerNodes[workerNodeKey].workerUsage.runTime.median
- : this.pool.workerNodes[workerNodeKey].workerUsage.runTime.average
+ ? this.pool.workerNodes[workerNodeKey].usage.runTime.median
+ : this.pool.workerNodes[workerNodeKey].usage.runTime.average
}
/**
*/
protected getWorkerTaskWaitTime (workerNodeKey: number): number {
return this.taskStatisticsRequirements.waitTime.median
- ? this.pool.workerNodes[workerNodeKey].workerUsage.waitTime.median
- : this.pool.workerNodes[workerNodeKey].workerUsage.waitTime.average
+ ? this.pool.workerNodes[workerNodeKey].usage.waitTime.median
+ : this.pool.workerNodes[workerNodeKey].usage.waitTime.average
}
/**
*/
protected getWorkerTaskElu (workerNodeKey: number): number {
return this.taskStatisticsRequirements.elu.median
- ? this.pool.workerNodes[workerNodeKey].workerUsage.elu.active.median
- : this.pool.workerNodes[workerNodeKey].workerUsage.elu.active.average
+ ? this.pool.workerNodes[workerNodeKey].usage.elu.active.median
+ : this.pool.workerNodes[workerNodeKey].usage.elu.active.average
}
protected computeDefaultWorkerWeight (): number {
// */
// private findFirstFreeWorkerNodeKey (): number {
// return this.pool.workerNodes.findIndex(workerNode => {
- // return workerNode.workerUsage.tasks.executing === 0
+ // return workerNode.usage.tasks.executing === 0
// })
// }
// private findLastFreeWorkerNodeKey (): number {
// // It requires node >= 18.0.0:
// // return this.workerNodes.findLastIndex(workerNode => {
- // // return workerNode.workerUsage.tasks.executing === 0
+ // // return workerNode.usage.tasks.executing === 0
// // })
// for (
// let workerNodeKey = this.pool.workerNodes.length - 1;
// workerNodeKey >= 0;
// workerNodeKey--
// ) {
- // if (
- // this.pool.workerNodes[workerNodeKey].workerUsage.tasks.executing === 0
- // ) {
+ // if (this.pool.workerNodes[workerNodeKey].usage.tasks.executing === 0) {
// return workerNodeKey
// }
// }