mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-06 14:53:19 +00:00
Add terminate-runner job in benchmarks.yml (#5611)
This commit is contained in:
parent
66f615a3a4
commit
cb894061f7
29
.github/workflows/benchmarks.yml
vendored
29
.github/workflows/benchmarks.yml
vendored
@ -34,13 +34,15 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
repo_token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
|
repo_token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cml runner launch \
|
OUTPUT=$(cml runner launch \
|
||||||
--single \
|
|
||||||
--cloud aws \
|
--cloud aws \
|
||||||
--cloud-region ${{ env.AWS_REGION }} \
|
--cloud-region ${{ env.AWS_REGION }} \
|
||||||
--cloud-type=p3.2xlarge \
|
--cloud-type=p3.2xlarge \
|
||||||
--cloud-hdd-size=64 \
|
--cloud-hdd-size=64 \
|
||||||
--labels=cml
|
--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:
|
run-reader-benchmarks:
|
||||||
needs: deploy-runner
|
needs: deploy-runner
|
||||||
@ -226,3 +228,24 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: benchmark-results-opensearch
|
name: benchmark-results-opensearch
|
||||||
path: test/benchmarks/out/
|
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