this.opts.workerChoiceStrategy = workerChoiceStrategy
for (const workerNode of this.workerNodes) {
this.setWorkerNodeTasksUsage(workerNode, {
- run: 0,
+ ran: 0,
running: 0,
runTime: 0,
runTimeHistory: new CircularArray(),
const workerTasksUsage =
this.workerNodes[this.getWorkerNodeKey(worker)].tasksUsage
--workerTasksUsage.running
- ++workerTasksUsage.run
+ ++workerTasksUsage.ran
if (message.error != null) {
++workerTasksUsage.error
}
workerTasksUsage.runTime += message.runTime ?? 0
if (
this.workerChoiceStrategyContext.getRequiredStatistics().avgRunTime &&
- workerTasksUsage.run !== 0
+ workerTasksUsage.ran !== 0
) {
workerTasksUsage.avgRunTime =
- workerTasksUsage.runTime / workerTasksUsage.run
+ workerTasksUsage.runTime / workerTasksUsage.ran
}
if (
this.workerChoiceStrategyContext.getRequiredStatistics().medRunTime &&
workerTasksUsage.waitTime += message.waitTime ?? 0
if (
this.workerChoiceStrategyContext.getRequiredStatistics().avgWaitTime &&
- workerTasksUsage.run !== 0
+ workerTasksUsage.ran !== 0
) {
workerTasksUsage.avgWaitTime =
- workerTasksUsage.waitTime / workerTasksUsage.run
+ workerTasksUsage.waitTime / workerTasksUsage.ran
}
if (
this.workerChoiceStrategyContext.getRequiredStatistics().medWaitTime &&
return this.workerNodes.push({
worker,
tasksUsage: {
- run: 0,
+ ran: 0,
running: 0,
runTime: 0,
runTimeHistory: new CircularArray(),
)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: 0,
+ ran: 0,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
}
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: 0,
+ ran: 0,
running: maxMultiplier,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: expect.any(Number),
+ ran: expect.any(Number),
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(maxMultiplier)
+ expect(workerNode.tasksUsage.ran).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.ran).toBeLessThanOrEqual(maxMultiplier)
}
pool.setWorkerChoiceStrategy(WorkerChoiceStrategies.FAIR_SHARE)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: 0,
+ ran: 0,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: expect.any(Number),
+ ran: expect.any(Number),
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
+ expect(workerNode.tasksUsage.ran).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.ran).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
}
// We need to clean up the resources after our test
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: expect.any(Number),
+ ran: expect.any(Number),
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
+ expect(workerNode.tasksUsage.ran).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.ran).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
}
// We need to clean up the resources after our test
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: expect.any(Number),
+ ran: expect.any(Number),
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThanOrEqual(0)
- expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
+ expect(workerNode.tasksUsage.ran).toBeGreaterThanOrEqual(0)
+ expect(workerNode.tasksUsage.ran).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThanOrEqual(0)
expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThanOrEqual(0)
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: expect.any(Number),
+ ran: expect.any(Number),
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
+ expect(workerNode.tasksUsage.ran).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.ran).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.avgRunTime).toBeGreaterThan(0)
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: expect.any(Number),
+ ran: expect.any(Number),
running: 0,
runTime: expect.any(Number),
runTimeHistory: expect.any(CircularArray),
medWaitTime: 0,
error: 0
})
- expect(workerNode.tasksUsage.run).toBeGreaterThan(0)
- expect(workerNode.tasksUsage.run).toBeLessThanOrEqual(max * maxMultiplier)
+ expect(workerNode.tasksUsage.ran).toBeGreaterThan(0)
+ expect(workerNode.tasksUsage.ran).toBeLessThanOrEqual(max * maxMultiplier)
expect(workerNode.tasksUsage.runTime).toBeGreaterThan(0)
expect(workerNode.tasksUsage.medRunTime).toBeGreaterThan(0)
}
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),
await Promise.all(promises)
for (const workerNode of pool.workerNodes) {
expect(workerNode.tasksUsage).toStrictEqual({
- run: maxMultiplier,
+ ran: maxMultiplier,
running: 0,
runTime: 0,
runTimeHistory: expect.any(CircularArray),