Skip to content

Commit 9192b06

Browse files
KFP-783: fix 13
1 parent 00bc777 commit 9192b06

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

.github/workflows/run-perf-tests.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,33 @@ jobs:
110110
--out csv=/test/test_results.csv \
111111
/test/script.js
112112
113+
- name: Lambda cleanup phase
114+
if: always()
115+
env:
116+
PROVISIONED_CONCURRENCY: 5
117+
WARMUP_DURATION_MS: 30000
118+
run: |
119+
# Set Lambda function name based on environment (same logic as warmup)
120+
if [ "${{ github.event_name }}" = "schedule" ]; then
121+
ENV="DEV"
122+
else
123+
ENV="${{ github.event.inputs.environment }}"
124+
fi
125+
126+
if [ "$ENV" = "STAGING" ]; then
127+
LAMBDA_FUNCTION_NAME="kainoscore-app-staging"
128+
else
129+
LAMBDA_FUNCTION_NAME="kainoscore-app-dev"
130+
fi
131+
132+
export LAMBDA_FUNCTION_NAME
133+
echo "Starting Lambda cleanup to remove provisioned concurrency..."
134+
echo "Environment: $ENV"
135+
echo "Lambda Function: $LAMBDA_FUNCTION_NAME"
136+
cd CoreDeployable/test/performance
137+
node cleanup.js
138+
echo "Lambda cleanup completed!"
139+
113140
- name: Upload test results
114141
uses: actions/upload-artifact@v4
115142
if: always()

CoreDeployable/test/performance/warmup.js

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,6 @@ async function setProvisionedConcurrency(functionName, concurrency) {
2929
}
3030
}
3131

32-
async function removeProvisionedConcurrency(functionName) {
33-
console.log(`Removing provisioned concurrency for function: ${functionName}`);
34-
35-
const command = new DeleteProvisionedConcurrencyConfigCommand({
36-
FunctionName: functionName,
37-
Qualifier: LAMBDA_QUALIFIER,
38-
});
39-
40-
try {
41-
await lambdaClient.send(command);
42-
console.log(`Provisioned concurrency removed successfully`);
43-
} catch (error) {
44-
if (error.name === 'ResourceNotFoundException') {
45-
console.log(`No provisioned concurrency configuration found (already removed)`);
46-
} else {
47-
console.error(`Failed to remove provisioned concurrency:`, error.message);
48-
throw error;
49-
}
50-
}
51-
}
52-
5332
async function waitForProvisionedConcurrency(functionName, maxWaitTime = 180000) {
5433
console.log(`Waiting for provisioned concurrency to become ready`);
5534

@@ -103,20 +82,14 @@ async function warmupLambda() {
10382
if (isReady) {
10483
console.log(`Keeping Lambda warm for ${WARMUP_DURATION_MS}ms...`);
10584
await new Promise(resolve => setTimeout(resolve, WARMUP_DURATION_MS));
106-
console.log('Warmup completed!');
85+
console.log('Warmup completed! Lambda is ready for performance tests.');
10786
} else {
10887
console.log('Proceeding with performance tests even though warmup didn\'t fully complete.');
10988
}
11089

11190
} catch (error) {
11291
console.error('Warmup failed:', error.message);
11392
throw error;
114-
} finally {
115-
try {
116-
await removeProvisionedConcurrency(FUNCTION_NAME);
117-
} catch (cleanupError) {
118-
console.error('Failed to clean up provisioned concurrency:', cleanupError.message);
119-
}
12093
}
12194
}
12295

0 commit comments

Comments
 (0)