Skip to content

Commit

Permalink
Rewrite scaleDown to fix a series of bugs (#864)
Browse files Browse the repository at this point in the history
On scaleDown:

- [FIX] Guaranteed stop the runners from the oldest to the newest,
avoiding having runners for too long;
- [FIX] Fixed bug where a runner could be removed from GHA but kept
running on AWS;
- [IMPROVED] Try to maintain always a minimum of `minAvailableRunners`
runners free;
  • Loading branch information
jeanschmidt authored Oct 12, 2022
1 parent 51d8113 commit 63f4a29
Show file tree
Hide file tree
Showing 8 changed files with 1,244 additions and 341 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { scaleDown as scaleDownL, scaleUp as scaleUpL } from './lambda';
import { Context, SQSEvent, ScheduledEvent } from 'aws-lambda';
import { mocked } from 'ts-jest/utils';
import nock from 'nock';
import scaleDown from './scale-runners/scale-down';
import { scaleDown } from './scale-runners/scale-down';
import { scaleUp } from './scale-runners/scale-up';

jest.mock('./scale-runners/scale-down');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Context, SQSEvent, ScheduledEvent } from 'aws-lambda';

import scaleDownR from './scale-runners/scale-down';
import { scaleDown as scaleDownR } from './scale-runners/scale-down';
import { scaleUp as scaleUpR } from './scale-runners/scale-up';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export async function getRunnerTypes(

const config = YAML.parse(configYml);
const result: Map<string, RunnerType> = new Map(
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
(Object.entries(config.runner_types) as [string, any][]).map(([prop, runner_type]) => [
prop,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ export class ScaleDownMetrics extends Metrics {
this.countEntry('run.count');
}

/* istanbul ignore next */
exception() {
this.countEntry('run.exceptions_count');
}

/* istanbul ignore next */
runnerLessMinimumTime(ec2Runner: RunnerInfo) {
this.countEntry(`run.ec2runners.notMinTime`);
Expand Down
Loading

0 comments on commit 63f4a29

Please sign in to comment.