mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-01 04:13:26 +00:00
Add terminate-runner job in benchmarks.yml (#5611)
This commit is contained in:
parent
66f615a3a4
commit
cb894061f7
37
.github/workflows/benchmarks.yml
vendored
37
.github/workflows/benchmarks.yml
vendored
@ -34,13 +34,15 @@ jobs:
|
||||
env:
|
||||
repo_token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
|
||||
run: |
|
||||
cml runner launch \
|
||||
--single \
|
||||
--cloud aws \
|
||||
--cloud-region ${{ env.AWS_REGION }} \
|
||||
--cloud-type=p3.2xlarge \
|
||||
--cloud-hdd-size=64 \
|
||||
--labels=cml
|
||||
OUTPUT=$(cml runner launch \
|
||||
--cloud aws \
|
||||
--cloud-region ${{ env.AWS_REGION }} \
|
||||
--cloud-type=p3.2xlarge \
|
||||
--cloud-hdd-size=64 \
|
||||
--labels=cml 2>&1 | tee /dev/fd/2)
|
||||
# Extract 'id' from the log and set it as an environment variable
|
||||
ID_VALUE=$(echo "$OUTPUT" | jq -r '.message? | fromjson? | select(.id != null) | .id // empty')
|
||||
echo "cml_runner_id=$ID_VALUE" >> "$GITHUB_OUTPUT"
|
||||
|
||||
run-reader-benchmarks:
|
||||
needs: deploy-runner
|
||||
@ -226,3 +228,24 @@ jobs:
|
||||
with:
|
||||
name: benchmark-results-opensearch
|
||||
path: test/benchmarks/out/
|
||||
|
||||
terminate-runner:
|
||||
if: always()
|
||||
needs:
|
||||
- deploy-runner
|
||||
- run-opensearch-benchmarks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: AWS authentication
|
||||
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355
|
||||
with:
|
||||
aws-region: ${{ env.AWS_REGION }}
|
||||
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
|
||||
|
||||
- name: Terminate EC2 instance
|
||||
env:
|
||||
CML_RUNNER_ID: ${{needs.deploy-runner.outputs.cml_runner_id}}
|
||||
run: |
|
||||
# Get the instance ID using its Name tag and terminate the instance
|
||||
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=${{ env.CML_RUNNER_ID }}" --query "Reservations[*].Instances[*].[InstanceId]" --output text)
|
||||
aws ec2 terminate-instances --instance-ids "$INSTANCE_ID"
|
||||
|
Loading…
x
Reference in New Issue
Block a user