Skip to content

Commit

Permalink
[ci] add cloudwatch metrics for scheduled workflow failures (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
siddvenk authored Jan 26, 2024
1 parent b5b0581 commit c548b0a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/canary-model-zoo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ jobs:
if: ${{github.event.inputs.download}} == 'huggingface' || ${{github.event.inputs.download}} == 'all'
working-directory: canary
run: DJL_ENGINE=tokenizers ./gradlew run -Dmain="ai.djl.canary.ModelZooTest"

publish-success-metric:
needs: [ canary-modelzoo ]
if: always()
uses: ./.github/workflows/publish-job-success.yml
with:
metric-name: DJLDemo-CanaryModelZoo-Failure
7 changes: 7 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ jobs:
repo-id: ${{ github.events.inputs.repo-id }}
djl-version: ${{ github.event.inputs.djl-version }}
pt-version: ${{ github.event.inputs.pt-version }}

publish-success-metric:
needs: [ aarch64-linux, centos, gpu, m1-mac, mac, ubuntu, windows ]
if: always()
uses: ./.github/workflows/publish-job-success.yml
with:
metric-name: DJLDemo-Canary-Failure
6 changes: 6 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ jobs:
cd extension && mvn package install && cd ..
cd extension-example && ./mvnw package
publish-success-metric:
needs: [ compile-test ]
if: always()
uses: ./.github/workflows/publish-job-success.yml
with:
metric-name: DJLDemo-NightlyIntegrationTest-Failure
27 changes: 27 additions & 0 deletions .github/workflows/publish-job-success.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Job Success Metric to CloudWatch

on:
workflow_call:
inputs:
metric-name:
description: "The name of the job to publish a metric for"
type: string
required: true

jobs:
publish-job-success-to-cloudwatch:
if: ${{ github.event_name == 'schedule' }}
runs-on: [ self-hosted, scheduler ]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-west-2
- name: Publish Job Success Metric
run: |
[[ ${{ job.status }} == "success" ]]
failedBuild=$?
aws cloudwatch put-metric-data --namespace GithubCI \
--metric-name ${{ inputs.metric-name }} \
--value $failedBuild \
--unit Count

0 comments on commit c548b0a

Please sign in to comment.